Example #1
0
 function __construct()
 {
     parent::__construct(false, __("aMember Widget", 'am4-plugin'), array('classname' => 'widget_text', 'description' => __('Login form and aMember subscriptions links', 'am4-plugin')));
     $this->addFormElement("text", 'before_login_title', __('Before Login Title:', 'am4-plugin'), __('Login', 'am4-plugin'));
     $this->addFormElement("text", 'after_login_title', __('After Login Title:', 'am4-plugin'), __('Your Subscriptions', 'am4-plugin'));
     $this->addFormElement("text", 'password_title', __('Password Title', 'am4-plugin'), __('Password', 'am4-plugin'));
     $this->addFormElement("text", 'username_title', __('Username Title:', 'am4-plugin'), __('Login', 'am4-plugin'));
     $this->addFormElement("text", 'login_button_title', __('Login Button  Title:', 'am4-plugin'), __('Login', 'am4-plugin'));
     $this->addFormElement("text", 'register_link_title', __('Register Link Title:', 'am4-plugin'), __('Signup Here', 'am4-plugin'));
     $this->addFormElement("text", 'lost_password_title', __('Lost Password Title:', 'am4-plugin'), __('Lost Password', 'am4-plugin'));
     $this->addFormElement("text", 'renew_subscription_title', __('Renew Subscription Title:', 'am4-plugin'), __('Renew Subscription', 'am4-plugin'));
     $this->addFormElement("text", 'payment_history_title', __('Payment History Title:', 'am4-plugin'), __('Payment History', 'am4-plugin'));
     $this->addFormElement("text", 'logout_title', __('Logout Title:', 'am4-plugin'), __('Logout', 'am4-plugin'));
     $this->addFormElement("text", 'change_profile_title', __('Change Profile Title:', 'am4-plugin'), __('Edit Profile', 'am4-plugin'));
     $this->addFormElement("text", 'signup_page_url', __('Signup Page URL', 'am4-plugin'), am4PluginsManager::getAPI()->getSignupURL());
     $this->addFormElement("text", 'renewal_page_url', __('Renewal  Page URL', 'am4-plugin'), am4PluginsManager::getAPI()->getSignupURL());
     $this->addFormElement("text", 'lost_password_page_url', __('Lost Password Page URL', 'am4-plugin'), am4PluginsManager::getAPI()->getLoginURL());
     $this->addFormElement("text", 'profile_page_url', __('Profile Page URL', 'am4-plugin'), am4PluginsManager::getAPI()->getProfileURL());
     $this->addFormElement("text", 'history_page_url', __('Payment History Page URL', 'am4-plugin'), am4PluginsManager::getAmemberURL() . "/member/payment-history");
     $this->addFormElement("text", 'logout_page_url', __('Logout page URL', 'am4-plugin'), am4PluginsManager::getAPI()->getLogoutURL());
     $this->addFormElement("checkbox", 'amember_links', __('Active Subscriptions Links', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'renew_subscription_link', __('Renew subscription Link', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'payment_history_link', __('Payment History Link', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'logout_link', __('Logout Link', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'register_link', __('Register Link', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'forgot_password_link', __('Forgot Password Link', 'am4-plugin'), 1);
     $this->addFormElement("checkbox", 'change_profile_link', __('Change Profile Link', 'am4-plugin'), 1);
 }
Example #2
0
 function run($atts = array(), $content = '')
 {
     $ret = '';
     if (($api = am4PluginsManager::getAPI()) && $api->isLoggedIn()) {
         $user = $api->getUser();
         $url = am4PluginsManager::getAmemberURL();
         $vars = array('r' => $user['user_id']);
         if (array_key_exists('id', $atts) && $atts['id']) {
             $vars['i'] = $atts['id'];
         }
         if (array_key_exists('title', $atts) && $atts['title']) {
             $ret = sprintf("<a href='%s/aff/go?%s'>%s</a>", $url, http_build_query($vars, '', '&'), $title);
         } else {
             $ret = sprintf("%s/aff/go?%s", $url, http_build_query($vars, '', '&'));
         }
     }
     return $ret;
 }