Example #1
1
 /**
  * 
  *  Woo User Menu
  */
 function user_menu()
 {
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $user_data = get_userdata(get_current_user_id());
     $avatar = get_option('show_avatars') ? '<span class="avatar">' . get_avatar(get_current_user_id(), 20) . '</span>' : '';
     $tag = get_option('permalink_structure') == false ? '&' : '?';
     $html = '<nav id="woo-user-menu">';
     $html .= '<ul class="sf-menu clearfix">';
     if (is_user_logged_in()) {
         $html .= '<li class="my-account"><a href="' . $url['account_overview'] . '">' . $avatar . esc_attr__('Howdy, ', 'Twoot') . $user_data->display_name . '</a>';
         $html .= '<ul>';
         $html .= '<li class="account-change-pw"><a href="' . $url['account_change_pw'] . '">' . esc_attr__('Change Password', 'Twoot') . '</a></li>';
         $html .= '<li class="account-edit-adress"><a href="' . $url['account_edit_adress'] . '">' . esc_attr__('Edit Address', 'Twoot') . '</a></li>';
         $html .= '<li class="account-view-order"><a href="' . $url['account_view_order'] . '">' . esc_attr__('View Order', 'Twoot') . '</a></li>';
         $html .= '<li class="cart"><a href="' . $url['cart'] . '">' . esc_attr__('Shopping Cart', 'Twoot') . '</a></li>';
         $html .= '<li class="checkout"><a href="' . $url['checkout'] . '">' . esc_attr__('Checkout', 'Twoot') . '</a></li>';
         $html .= '</ul>';
         $html .= '</li>';
         $html .= '<li class="logout last"><a href="' . $url['logout'] . '">' . esc_attr__('Sign Out', 'Twoot') . '</a></li>';
     } else {
         if (get_option('users_can_register') && get_option('woocommerce_enable_myaccount_registration') == 'yes') {
             $html .= '<li class="register"><a href="' . $url['register'] . $tag . 'user_account=register">' . esc_attr__('Create Account', 'Twoot') . '</a></li>';
         }
         $html .= '<li class="login last"><a href="' . $url['account_overview'] . $tag . 'user_account=login">' . esc_attr__('Sign In', 'Twoot') . '</a></li>';
     }
     $html .= '</ul>';
     $html .= '</nav>';
     return $html;
 }
function bbconnect_add_local_avatar_form($args = null)
{
    // SET THE DEFAULTS TO BE OVERRIDDEN AS DESIRED
    $defaults = array('fdata' => false, 'fvalue' => false, 'faction' => false, 'ftype' => false);
    // PARSE THE INCOMING ARGS
    $args = wp_parse_args($args, $defaults);
    // EXTRACT THE VARIABLES
    extract($args, EXTR_SKIP);
    if (is_user_logged_in()) {
        if ('-edit' == $faction) {
            if (is_plugin_active('add-local-avatar/avatars.php') && false != $fdata) {
                $ala = new add_local_avatars();
                $ala->avatar_uploader_option($fdata);
            }
        } else {
            if ('-view' == $faction) {
                echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
            } else {
            }
        }
    } else {
        if (false != $fdata) {
            echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
        }
    }
}
 function ajax_refresh_static_posts()
 {
     check_ajax_referer('refreshstaticposts');
     if (isset($_POST['number'])) {
         $number = absint($_POST['number']);
         $action = sanitize_text_field($_POST['action']);
         $name = sanitize_text_field($_POST['name']);
         //Get the SRP widgets
         $settings = get_option($name);
         $widget = $settings[$number];
         //Get the new post IDs
         $widget = $this->build_posts(intval($widget['postlimit']), $widget);
         $post_ids = $widget['posts'];
         //Save the settings
         $settings[$number] = $widget;
         //Only save if user is admin
         if (is_user_logged_in() && current_user_can('administrator')) {
             update_option($name, $settings);
             //Let's clean up the cache
             //Update WP Super Cache if available
             if (function_exists("wp_cache_clean_cache")) {
                 @wp_cache_clean_cache('wp-cache-');
             }
         }
         //Build and send the response
         die($this->print_posts($post_ids, false));
     }
     exit;
 }
function jobman_display_login()
{
    global $current_user;
    get_currentuserinfo();
    $options = get_option('jobman_options');
    $content = '';
    if (is_user_logged_in()) {
        $loggedin_html = '<div id="jobman_loggedin"><span class="message">';
        $loggedin_html .= apply_filters('jobman_loggedin_msg', sprintf(__('Welcome, %1s!', 'jobman'), $current_user->display_name));
        $loggedin_html .= '</span>';
        $loggedin_html .= '</div>';
        $content .= apply_filters('jobman_loggedin_html', $loggedin_html);
    } else {
        $login_html = '<form action="" method="post">';
        $login_html .= '<div id="jobman_login">';
        $login_html .= '<span class="message">';
        $login_html .= apply_filters('jobman_login_msg', __("If you've registered with us previously, please login now. If you'd like to register, please click the 'Register' link below.", 'jobman'));
        $login_html .= '</span>';
        $login_html .= '<label class="username" for="jobman_username">' . __('Username', 'jobman') . '</label>: ';
        $login_html .= '<input type="text" name="jobman_username" id="jobman_username" class="username" />';
        $login_html .= '<label class="password" for="jobman_password">' . __('Password', 'jobman') . '</label>: ';
        $login_html .= '<input type="password" name="jobman_password" id="jobman_password" class="password" />';
        $login_html .= '<input class="submit" type="submit" name="submit" value="' . __('Login', 'jobman') . '" />';
        $login_html .= '<span><a href="' . get_page_link($options['register_page']) . '">' . __('Register', 'jobman') . '</a> | <a href="' . wp_lostpassword_url(urlencode(jobman_current_url())) . '">' . __('Forgot your password?', 'jobman') . '</a></span></div>';
        $login_html .= '</form>';
        $content .= apply_filters('jobman_login_html', $login_html);
    }
    return $content;
}
Example #5
0
function amr_check_if_widget_debug()
{
    global $said;
    // only do these debug if we are logged in and are the administrator
    if (is_admin()) {
        return false;
    }
    // if running in backend, then do not do debug.  20151217
    if (!is_user_logged_in() or !current_user_can('administrator')) {
        return false;
    }
    if (isset($_REQUEST['do_widget_debug'])) {
        if (empty($said)) {
            $said = true;
        } else {
            return true;
        }
        $url_without_debug_query = esc_url(remove_query_arg('do_widget_debug'));
        $eek = '<a href="' . $url_without_debug_query . '">Remove debug</a>';
        echo '<br/>Note: Debug help is only shown to a logged-in Administrator.' . $eek . '<br />';
        $text = amr_show_shortcode_widget_possibilities();
        echo $text;
        return true;
    } else {
        return false;
    }
}
function wpcf7_mathcaptcha_shortcode_handler($tag)
{
    if (!is_user_logged_in() || is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users']) {
        $tag = new WPCF7_Shortcode($tag);
        if (empty($tag->name)) {
            return '';
        }
        $validation_error = wpcf7_get_validation_error($tag->name);
        $class = wpcf7_form_controls_class($tag->type);
        if ($validation_error) {
            $class .= ' wpcf7-not-valid';
        }
        $atts = array();
        $atts['size'] = 2;
        $atts['maxlength'] = 2;
        $atts['class'] = $tag->get_class_option($class);
        $atts['id'] = $tag->get_option('id', 'id', true);
        $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
        $atts['aria-required'] = 'true';
        $atts['type'] = 'text';
        $atts['name'] = $tag->name;
        $atts['value'] = '';
        $atts = wpcf7_format_atts($atts);
        $mc_form = Math_Captcha()->core->generate_captcha_phrase('cf7');
        $mc_form[$mc_form['input']] = '<input %2$s />';
        $math_captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
        return sprintf((empty($math_captcha_title) ? '' : $math_captcha_title) . '<span class="wpcf7-form-control-wrap %1$s">' . $mc_form[1] . $mc_form[2] . $mc_form[3] . '%3$s</span><input type="hidden" value="' . (Math_Captcha()->core->session_number - 1) . '" name="' . $tag->name . '-sn" />', $tag->name, $atts, $validation_error);
    }
}
Example #7
0
 function Dashboard()
 {
     global $wp_query;
     if (!is_user_logged_in()) {
         include wpdm_tpl_path('wpdm-be-member.php');
         return;
     }
     $udb_page = isset($wp_query->query_vars['udb_page']) ? $wp_query->query_vars['udb_page'] : '';
     $udb_page_parts = explode("/", $udb_page);
     $udb_page = $udb_page_parts[0];
     if (isset($this->dashboard_menu[$udb_page]['callback'])) {
         $dashboard_contents = call_user_func($this->dashboard_menu[$udb_page]['callback'], $udb_page_parts);
     } else {
         if (isset($this->dashboard_menu[$udb_page]['shortcode'])) {
             $dashboard_contents = do_shortcode($this->dashboard_menu[$udb_page]['shortcode']);
         } else {
             if (isset($this->dashboard_menu_actions[$udb_page])) {
                 $dashboard_contents = call_user_func($this->dashboard_menu_actions[$udb_page], $udb_page_parts);
             }
         }
     }
     //else if(isset($this->dashboard_menu_actions[$udb_page]['shortcode']))
     //    $dashboard_contents = do_shortcode($this->dashboard_menu_actions[$udb_page]['shortcode']);
     include_once wpdm_tpl_path('wpdm-dashboard.php');
 }
 /**
  * Constructor
  * @since 1.8
  * @uses string $pagenow
  * @uses bool $show_avatars
  * @uses object $wpua_admin
  * @uses bool $wpua_allow_upload
  * @uses add_action()
  * @uses add_filterI]()
  * @uses is_admin()
  * @uses is_user_logged_in()
  * @uses wpua_is_author_or_above()
  * @uses wpua_is_menu_page()
  */
 public function __construct()
 {
     global $pagenow, $show_avatars, $wpua_admin, $wpua_allow_upload;
     // Add WPUA to profile for users with permission
     if ($this->wpua_is_author_or_above() || (bool) $wpua_allow_upload == 1 && is_user_logged_in()) {
         // Profile functions and scripts
         add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
         add_action('personal_options_update', array($this, 'wpua_action_process_option_update'));
         add_action('edit_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
         add_action('edit_user_profile_update', array($this, 'wpua_action_process_option_update'));
         add_action('user_new_form', array($this, 'wpua_action_show_user_profile'));
         add_action('user_register', array($this, 'wpua_action_process_option_update'));
         // Admin scripts
         $pages = array('profile.php', 'options-discussion.php', 'user-edit.php', 'user-new.php');
         if (in_array($pagenow, $pages) || $wpua_admin->wpua_is_menu_page()) {
             add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
         }
         // Front pages
         if (!is_admin()) {
             add_action('show_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
             add_action('edit_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
         }
         if (!$this->wpua_is_author_or_above()) {
             // Upload errors
             add_action('user_profile_update_errors', array($this, 'wpua_upload_errors'), 10, 3);
             // Prefilter upload size
             add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'));
         }
     }
     add_filter('media_view_settings', array($this, 'wpua_media_view_settings'), 10, 1);
 }
/**
 * Has User Purchased
 *
 * Checks to see if a user has purchased a download.
 *
 * @access      public
 * @since       1.0
 * @param       int $user_id - the ID of the user to check
 * @param       array $downloads - Array of IDs to check if purchased. If an int is passed, it will be converted to an array
 * @param       int $variable_price_id - the variable price ID to check for
 * @return      boolean - true if has purchased, false otherwise
 */
function edd_has_user_purchased($user_id, $downloads, $variable_price_id = null)
{
    if (!is_user_logged_in()) {
        return false;
    }
    // At some point this should support email checking
    $users_purchases = edd_get_users_purchases($user_id);
    $return = false;
    if (!is_array($downloads)) {
        $downloads = array($downloads);
    }
    if ($users_purchases) {
        foreach ($users_purchases as $purchase) {
            $purchased_files = edd_get_payment_meta_downloads($purchase->ID);
            if (is_array($purchased_files)) {
                foreach ($purchased_files as $download) {
                    if (in_array($download['id'], $downloads)) {
                        $variable_prices = edd_has_variable_prices($download['id']);
                        if ($variable_prices && !is_null($variable_price_id) && $variable_price_id !== false) {
                            if (isset($download['options']['price_id']) && $variable_price_id == $download['options']['price_id']) {
                                return true;
                            } else {
                                $return = false;
                            }
                        } else {
                            $return = true;
                        }
                    }
                }
            }
        }
    }
    return $return;
}
    public function ForgotPassForm()
    {
        if (!session_id()) {
            @session_start();
        }
        $this->error_message();
        if (!is_user_logged_in()) {
            ?>
			<div id="log_forms forgot_pass">
			<form name="forgot" id="forgot" method="post" action="">
			<input type="hidden" name="option" value="afo_forgot_pass" />
			<div class="form-group">
				<label for="email"><?php 
            _e('Email', 'login-sidebar-widget');
            ?>
 </label>
				<input type="text" name="user_username" required="required"/>
			</div>
			<div class="form-group"><label for="login">&nbsp;</label><input name="forgot" type="submit" value="<?php 
            _e('Submit', 'login-sidebar-widget');
            ?>
" /></div>
			<div class="form-group forgot-text"><?php 
            _e('Please enter your email. The password reset link will be provided in your email.', 'login-sidebar-widget');
            ?>
</div>
			</form>
			</div>
		<?php 
        }
    }
Example #11
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $not_login = esc_attr($instance['not_login']);
        $register_like_button = esc_attr($instance['register_like_button']);
        if (empty($not_login) || !is_user_logged_in()) {
            echo $before_widget;
            if ($title) {
                echo $before_title . esc_attr($title) . $after_title;
            }
            ?>
				<div class="widget_login">
					<?php 
            if (!is_user_logged_in()) {
                echo '<div class="form-style form-style-2">
							' . do_shortcode("[ask_login" . (isset($register_like_button) && $register_like_button == "on" ? " register='button'" : "") . "]");
                if (empty($register_like_button)) {
                    echo '<ul class="login-links login-links-r">
									<li><a href="#">' . __("Register", "vbegy") . '</a></li>
								</ul>';
                }
                echo '<div class="clearfix"></div>
						</div>';
            } else {
                echo do_shortcode("[ask_login]");
            }
            ?>
				</div>
				<?php 
            echo $after_widget;
        }
    }
Example #12
0
 public function __construct()
 {
     // Objects
     $this->oBase64 = new FetchTweets_Base64();
     // For transient (cache) renewal events
     add_action('fetch_tweets_action_transient_renewal', array($this, '_replyToRenewTransients'));
     // For transient (cache) formatting events - adds oEmbed elements.
     add_action('fetch_tweets_action_transient_add_oembed_elements', array($this, '_replyToAddOEmbedElements'));
     // For SimplePie cache renewal events
     add_action('fetch_tweets_action_simplepie_renew_cache', array($this, '_replyToRenewSimplePieCaches'));
     // This must be called after the above action hooks are added.
     if ('intense' == $GLOBALS['oFetchTweets_Option']->aOptions['cache_settings']['caching_mode']) {
         new FetchTweets_Cron(apply_filters('fetch_tweets_filter_plugin_cron_actions', array('fetch_tweets_action_transient_renewal', 'fetch_tweets_action_transient_add_oembed_elements', 'fetch_tweets_action_simplepie_renew_cache')));
     } else {
         if (FetchTweets_Cron::isBackground()) {
             exit;
         }
     }
     // Redirects
     if (isset($_GET['fetch_tweets_link']) && $_GET['fetch_tweets_link']) {
         $_oRedirect = new FetchTweets_Redirects();
         $_oRedirect->go($_GET['fetch_tweets_link']);
         // will exit there.
     }
     // Draw the cached image.
     if (isset($_GET['fetch_tweets_image']) && $_GET['fetch_tweets_image'] && is_user_logged_in()) {
         $_oImageLoader = new FetchTweets_ImageHandler('FTWS');
         $_oImageLoader->draw($_GET['fetch_tweets_image']);
         exit;
     }
     // For the activation hook
     add_action('fetch_tweets_action_setup_transients', array($this, '_replyToSetUpTransients'));
 }
Example #13
0
/**
 * Check if a popup is available for the current page.
 *
 * The function checks, in this order, if a popup is available for:
 * - The current post
 * - The current post type
 * - The whole site
 *
 * @since  1.0.0
 *
 * @param int $post_id Optional post ID to check for popup availability
 *
 * @return bool|int Popup ID if a popup is available, false otherwise
 */
function wpbo_page_has_popup($post_id = 0)
{
    /**
     * Checks in order:
     *
     * 1. Front-page
     * 2. Homepage
     * 3. Archives
     *  3.1 Search
     *  3.2 Post type
     * 4. 404
     * 5. Singular
     */
    $post_id = wpbo_get_post_id($post_id);
    /**
     * First of all let's check if the user is an admin
     * and if popups are hidden for admins.
     */
    if (is_user_logged_in() && current_user_can('administrator') && true === (bool) wpbo_get_option('hide_admins', false)) {
        return false;
    }
    // Try to get the popup from the cache
    $popup_id = wpbo_get_cached_popup($post_id);
    if (false === $popup_id) {
        $popup_id = wpbo_get_popup($post_id);
    }
    // Cache popup ID to avoid calculating again on page refresh */
    if (false !== $popup_id) {
        wpbo_cache_popup($popup_id, $post_id);
    }
    return $popup_id;
}
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since 1.6.0
 *
 * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        $bp = buddypress();
        // Stored in the global so we can add menus easily later on
        $bp->my_account_menu_id = 'my-account-buddypress';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(bp_get_requested_url())));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
Example #15
0
    /**
     * Render the widget.
     *
     * @see WP_Widget::widget() for a description of parameters.
     *
     * @param array $args See {@WP_Widget::widget()}.
     * @param array $args See {@WP_Widget::widget()}.
     */
    public function widget($args, $instance)
    {
        if (!is_user_logged_in()) {
            return;
        }
        // Don't display the widget if there are no Notices to show
        $notices = BP_Messages_Notice::get_active();
        if (empty($notices)) {
            return;
        }
        extract($args);
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $title = apply_filters('widget_title', $title, $instance);
        echo $before_widget;
        echo $before_title . $title . $after_title;
        ?>

		<div class="bp-site-wide-message">
			<?php 
        bp_message_get_notices();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
Example #16
0
    /**
     * Get a vote link to something.
     *
     * @param int $id Object id
     * @param string $vote_type Type of vote: 'up' or 'down'
     * @param string $vote_type Current vote, if any
     * @param string $link_text The content of the link
     * @return string
     */
    function get_link($id, $vote_type, $current_vote, $link_text)
    {
        $voted = $vote_type == $current_vote;
        if (!$voted) {
            $vote = $vote_type;
        } else {
            $vote = 'undo';
        }
        $data = array('action' => 'qa_vote', 'post_id' => $id, 'vote_type' => $vote);
        $input_attr = array('type' => 'submit', 'title' => $link_text, 'class' => "vote-{$vote_type}-" . ($voted ? 'on' : 'off'));
        if (!is_user_logged_in()) {
            $input_attr['data-msg'] = 'login';
        } elseif (get_post_field('post_author', $id) == get_current_user_id()) {
            $input_attr['data-msg'] = 'own';
        }
        ob_start();
        ?>
<form method="post" action="">
	<?php 
        wp_nonce_field('qa_vote');
        ?>

	<?php 
        foreach ($data as $key => $value) {
            echo _qa_html('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
        }
        ?>

	<?php 
        echo _qa_html('input', $input_attr);
        ?>
</form>
<?php 
        return ob_get_clean();
    }
 /**
  * Display the widget on the frontend.
  * @since  1.0.0
  * @param  array $args     Widget arguments.
  * @param  array $instance Widget settings for this instance.
  * @return void
  */
 public function widget($args, $instance)
 {
     remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
     if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && !is_user_logged_in()) {
         // No Output
         return;
     } else {
         /* Our variables from the widget settings. */
         $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         /* Before widget (defined by themes). */
         echo $args['before_widget'];
         /* Display the widget title if one was input (before and after defined by themes). */
         if ($title) {
             echo $args['before_title'] . $title . $args['after_title'];
         }
         /* Widget content. */
         // Add actions for plugins/themes to hook onto.
         do_action($this->woo_widget_cssclass . '_top');
         if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
             $this->load_component($instance);
         }
         // Add actions for plugins/themes to hook onto.
         do_action($this->woo_widget_cssclass . '_bottom');
         /* After widget (defined by themes). */
         echo $args['after_widget'];
     }
     // End If Statement
     add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
 }
 function callback($path = '', $blog_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         $this->load_theme_functions();
     }
     if (!is_user_logged_in()) {
         return new WP_Error('Unauthorized', 'You must be logged-in to manage settings.', 401);
     } else {
         if (!current_user_can('manage_options')) {
             return new WP_Error('Forbidden', 'You do not have the capability to manage settings for this site.', 403);
         }
     }
     if ('GET' === $this->api->method) {
         /**
          * Fires on each GET request to a specific endpoint.
          *
          * @since 3.2.0
          *
          * @param string sites.
          */
         do_action('wpcom_json_api_objects', 'sites');
         return $this->get_settings_response();
     } else {
         if ('POST' === $this->api->method) {
             return $this->update_settings();
         } else {
             return new WP_Error('bad_request', 'An unsupported request method was used.');
         }
     }
 }
 public function ask_form_name_field($args)
 {
     if (!is_user_logged_in() && ap_opt('allow_anonymous')) {
         $args['fields'][] = array('name' => 'name', 'label' => __('Name', 'ap'), 'type' => 'text', 'placeholder' => __('Enter your name to display', 'ap'), 'value' => sanitize_text_field(@$_POST['name']), 'order' => 12);
     }
     return $args;
 }
    function rtmedia_login_register_modal_popup()
    {
        if (!is_user_logged_in()) {
            ?>
            <div class="rtmedia-popup mfp-hide rtm-modal" id="rtmedia-login-register-modal">
                <div id="rtm-modal-container">
                    <h2 class="rtm-modal-title"><?php 
            _e('Please login', 'buddypress-media');
            ?>
</h2>

                    <p><?php 
            _e("You need to be logged in to upload Media or to create Album.", 'buddypress-media');
            ?>
</p>

                    <p>
                        <?php 
            echo __('Click', 'buddypress-media') . ' <a href="' . wp_login_url($_SERVER['REQUEST_URI']) . '" title="' . __('Login', 'buddypress-media') . '">' . __('HERE', 'buddypress-media') . '</a>' . __(' to login.', 'buddypress-media');
            ?>
                    </p>
                </div>
            </div>
            <?php 
        }
    }
Example #21
0
function soloUsuarioRegistrado()
{
    if (!is_user_logged_in()) {
        wp_redirect(home_url(), 302);
        exit;
    }
}
 public function filter_the_content($content)
 {
     $ww_problem = false;
     if (is_page('webwork')) {
         $ww_problem = true;
     } else {
         $ww_problem = get_query_var('ww_problem');
     }
     if ($ww_problem) {
         $content = '<div id="webwork-app"></div>';
         wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js');
         $route_base = get_option('home');
         $route_base = preg_replace('|https?://[^/]+/|', '', $route_base);
         // @todo Centralize this logic.
         $main_site_url = get_blog_option(1, 'home');
         $rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/';
         // @todo Abstract.
         $post_data = null;
         $ww_problem_text = '';
         if (!empty($_GET['post_data_key'])) {
             $post_data = get_blog_option(1, $_GET['post_data_key']);
             $ww_problem_text = base64_decode($post_data['pg_object']);
         }
         // @todo This is awful.
         $clients = get_blog_option(1, 'webwork_clients');
         $remote_course_url = array_search(get_current_blog_id(), $clients);
         wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in()));
         wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css');
         wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js');
         $webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full'));
         wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings);
         wp_enqueue_script('webwork-mathjax-loader');
     }
     return $content;
 }
Example #23
0
/**
 * Shortcode hook to display output HTML from CubePM
 * 
 * @todo Add support for blogs without permalink enabled
 * 
 * @param array $atts An associative array of attributes
 * @return string HTML output of CubePM
 */
function cpm_shortcode($atts)
{
    $html = '<div class="cubepm">';
    if (is_user_logged_in()) {
        $html .= cpm_header();
        $cpm_action = $_GET['cpm_action'];
        switch ($cpm_action) {
            default:
            case 'inbox':
                $html .= cpm_page_inbox();
                break;
            case 'new':
                $html .= cpm_page_new();
                break;
            case 'read':
                $html .= cpm_page_read();
                break;
            case 'admin-inbox':
                if (current_user_can('administrator')) {
                    $html .= cpm_page_admin_inbox();
                } else {
                    $html .= cpm_page_inbox();
                }
        }
    } else {
        $html .= '<p>' . __('You have to be logged in to use Private Messaging.', 'cubepm') . '<br /><a href="' . wp_login_url(site_url($_SERVER["REQUEST_URI"])) . '">' . __('Click here to login', 'cubepm') . ' &raquo;</a></p>';
    }
    $html .= '</div>';
    return $html;
}
Example #24
0
 public function get_attachments()
 {
     global $json_api;
     global $user_ID;
     // todo
     // support attachments by user
     // support attachments by post (this is supported)
     // support returning no attachments if user is not logged in
     // support returning all attachments for parent and it's descendents
     if (is_user_logged_in()) {
         $loggedIn = (bool) true;
     } else {
         $loggedIn = (bool) false;
     }
     if ($loggedIn) {
         $user = get_userdata($user_ID);
     }
     if ($json_api->query->parent !== "null") {
         $parent = (int) $json_api->query->parent;
     } else {
         $parent = null;
     }
     // we should check if the file the attachments are part of are published or not
     $attachments = $json_api->introspector->get_attachments($parent);
     $output = array('count' => count($attachments), 'attachments' => $attachments);
     return $output;
 }
 function __construct($args = '')
 {
     global $mdjm, $clientzone_loaded, $mdjm_settings;
     // Must be authenticated
     if (!is_user_logged_in()) {
         parent::login();
     } elseif (empty($mdjm_settings['templates']['online_enquiry'])) {
         parent::display_notice(4, sprintf(__('This option is disabled for your event. Please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>'));
     } elseif (!$this->should_i_be_here()) {
         // do validation
         parent::display_notice(4, sprintf(__('An error is stopping your access to this quotation. Please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>'));
     } else {
         if (isset($_GET['message'], $_GET['class'])) {
             parent::display_message($_GET['message'], $_GET['class']);
         }
         // Possible button settings
         $button_loc = array('before', 'after', 'both');
         $button_align = array('left', 'center', 'right');
         // Define button settings
         $this->book_button = !empty($args['book_button']) ? true : false;
         $this->button_loc = !empty($args['button_loc']) && in_array($button_loc) ? $args['button_loc'] : 'both';
         $this->button_align = !empty($args['button_align']) && in_array($button_loc) ? $args['button_align'] : 'center';
         $this->button_text = !empty($args['button_text']) ? $args['button_text'] : __('Book this Event', 'mobile-dj-manager');
         $this->button_class = !empty($args['button_class']) ? $args['button_class'] : false;
         $this->display_quote($_GET['event_id']);
     }
 }
Example #26
0
    function vcex_login_form_shortcode($atts, $content = NULL)
    {
        // Shortcode params
        extract(shortcode_atts(array('unique_id' => '', 'redirect' => ''), $atts));
        // If user is logged return text
        if (is_user_logged_in()) {
            return $content;
        }
        if ($redirect == '') {
            $redirect = site_url($_SERVER['REQUEST_URI']);
        }
        // Form args
        $args = array('echo' => true, 'redirect' => $redirect, 'form_id' => 'vcex-loginform', 'label_username' => __('Username', 'vcex'), 'label_password' => __('Password', 'vcex'), 'label_remember' => __('Remember Me', 'vcex'), 'label_log_in' => __('Log In', 'vcex'), 'remember' => true, 'value_username' => NULL, 'value_remember' => false);
        // Ouput form
        ob_start();
        ?>
		
			<div class="vcex-login-form clr">
				<?php 
        wp_login_form($args);
        ?>
			</div><!-- .vcex-login-form -->

		<?php 
        echo ob_get_clean();
    }
Example #27
0
 static function mark_review()
 {
     global $wpdb;
     $_watu = new WatuPRO();
     // this will only happen for logged in users
     if (!is_user_logged_in()) {
         return false;
     }
     $taking_id = $_watu->add_taking($_POST['exam_id'], 1);
     // select current data if any
     $marked_for_review = $wpdb->get_var($wpdb->prepare("SELECT marked_for_review FROM " . WATUPRO_TAKEN_EXAMS . "\n\t\t\tWHERE ID=%d", $taking_id));
     if (empty($marked_for_review)) {
         $marked_for_review = array("question_ids" => array(), "question_nums" => array());
     } else {
         $marked_for_review = unserialize($marked_for_review);
     }
     if ($_POST['act'] == 'mark') {
         $marked_for_review['question_ids'][] = $_POST['question_id'];
         $marked_for_review['question_nums'][] = $_POST['question_num'];
     } else {
         // unmark
         foreach ($marked_for_review['question_ids'] as $cnt => $id) {
             if ($id == $_POST['question_id']) {
                 unset($marked_for_review['question_ids'][$cnt]);
             }
         }
         foreach ($marked_for_review['question_nums'] as $cnt => $num) {
             if ($num == $_POST['question_num']) {
                 unset($marked_for_review['question_nums'][$cnt]);
             }
         }
     }
     // now save
     $wpdb->query($wpdb->prepare("UPDATE " . WATUPRO_TAKEN_EXAMS . " SET marked_for_review=%s WHERE ID=%d", serialize($marked_for_review), $taking_id));
 }
Example #28
0
 public function __construct()
 {
     if (!is_admin() || !is_user_logged_in()) {
         return;
     }
     //Only for admin
     $this->_gz_on = function_exists('gzuncompress') && function_exists('gzcompress');
     $this->settings = $this->get_settings();
     add_action('admin_notices', array($this, 'show_site_key_nags'));
     add_action('admin_notices', array($this, 'show_admin_messages'));
     add_action('admin_init', array($this, 'load_embedded_plugins'), 0);
     add_action('admin_menu', array($this, 'menu_setup'));
     add_action('network_admin_menu', array($this, 'menu_setup'));
     if (defined('DOING_AJAX') && isset($_POST['action']) && $_POST['action'] == 'installer_download_plugin') {
         add_filter('site_transient_update_plugins', array($this, 'plugins_upgrade_check'));
     }
     add_filter('plugins_api', array($this, 'custom_plugins_api_call'), 10, 3);
     add_filter('pre_set_site_transient_update_plugins', array($this, 'plugins_upgrade_check'));
     // register repositories
     $this->load_repositories_list();
     if (empty($this->settings['last_repositories_update']) || time() - $this->settings['last_repositories_update'] > 86400 || isset($_GET['force-check']) && $_GET['force-check'] == 1) {
         $this->refresh_repositories_data();
     }
     // default config
     $this->config['plugins_install_tab'] = false;
     add_action('init', array($this, 'init'));
     //add_filter('wp_installer_buy_url', array($this, 'append_parameters_to_buy_url'));
     add_action('init', array($this, 'load_locale'));
 }
function wplms_dashboard_template()
{
    if (!is_user_logged_in()) {
        wp_redirect(site_url());
    }
    $template = 'templates/dashboard';
    global $bp;
    if ($bp->current_component == 'dashboard') {
        wp_enqueue_style('wplms-dashboard-css', WPLMS_DASHBOARD_URL . '/css/wplms-dashboard.css', array(), '1.0');
        wp_enqueue_script('wplms-dashboard-js', WPLMS_DASHBOARD_URL . '/js/wplms-dashboard.js', array('jquery', 'jquery-ui-sortable'), '1.0');
        if (is_active_widget(false, false, 'wplms_instructor_dash_stats', true) || is_active_widget(false, false, 'wplms_dash_stats', true)) {
            wp_enqueue_script('wplms-sparkline', WPLMS_DASHBOARD_URL . '/js/jquery.sparkline.min.js', array('jquery'), true);
        }
        if (is_active_widget(false, false, 'wplms_instructor_stats', true) || is_active_widget(false, false, 'wplms_instructor_commission_stats', true) || is_active_widget(false, false, 'wplms_student_stats', true)) {
            wp_enqueue_script('wplms-raphael', WPLMS_DASHBOARD_URL . '/js/raphael-min.js', array('jquery'), true);
            wp_enqueue_script('wplms-morris', WPLMS_DASHBOARD_URL . '/js/morris.min.js', array('jquery'), true);
        }
        $translation_array = array('earnings' => __('Earnings', 'wplms-dashboard'), 'payout' => __('Payout', 'wplms-dashboard'), 'students' => __('# Students', 'wplms-dashboard'), 'saved' => __('SAVED', 'wplms-dashboard'), 'saving' => __('SAVING ...', 'wplms-dashboard'), 'stats_calculated' => __('Stats Calculated, reloading page ...', 'wplms-dashboard'));
        wp_localize_script('wplms-dashboard-js', 'wplms_dashboard_strings', $translation_array);
    }
    $located_template = apply_filters('bp_located_template', locate_template($template, false), $template);
    if ($located_template && $located_template != '') {
        bp_get_template_part(apply_filters('bp_load_template', $located_template));
    } else {
        bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/dashboard'));
    }
}
Example #30
-1
function d4p_bbt_is_role($setting_name) {
    global $gdbbpress_tools;
    $allowed = false;

    if (current_user_can('d4p_bbpt_'.$setting_name)) {
        $allowed = true;
    } else if (is_super_admin()) {
        $allowed = $gdbbpress_tools->o[$setting_name.'_super_admin'] == 1;
    } else if (is_user_logged_in()) {
        $roles = $gdbbpress_tools->o[$setting_name.'_roles'];

        if (is_null($roles)) {
            $allowed = true;
        } else if (is_array($roles)) {
            global $current_user;

            if (is_array($current_user->roles)) {
                $matched = array_intersect($current_user->roles, $roles);
                $allowed = !empty($matched);
            }
        }
    }

    return $allowed;
}