function userpro_social_shortcodes($args) { global $userpro; extract($args); global $users; $users = userpro_memberlist_loop($args); if ($args['template'] == 'socialwall') { if (is_user_logged_in() || userpro_userwall_get_option('nonloginusers') == 1) { include_once UPS_PLUGIN_DIR . 'templates/userwall.php'; } else { _e('You are not allowed to access this page. Please login to access It.', 'userpro-userwall'); } } }
?> </div> </div> <?php } ?> </div> <?php global $wp_query, $wpdb; $curauth = $wp_query->get_queried_object(); $post_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'userpro_userwall' AND post_status = 'publish'"); if ($post_count >= userpro_userwall_get_option('totalpost')) { ?> <div class="socialwall-load-more" id="socialwall-load-more" data-max-pages="<?php echo userpro_userwall_get_option('totalpost'); ?> "><span><?php _e('Load More...', 'userpro-userwall'); ?> <img src="<?php echo UPS_PLUGIN_URL . 'images/loader.GIF'; ?> " id="loademore-loader" /></span></div> <?php }
function socialwall_load_posts() { global $userpro; global $wp_query, $wpdb; $curauth = $wp_query->get_queried_object(); $post_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'userpro_userwall' AND post_status = 'publish'"); $postperpage = $_POST['count']; if ($post_count >= $postperpage) { echo '<div id="userwalldata">'; $args = array('posts_per_page' => userpro_userwall_get_option('totalpost'), 'offset' => $postperpage, 'category' => '', 'category_name' => '', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'userpro_userwall', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => true); $postslist = get_posts($args); foreach ($postslist as $post) { $user_id = get_post_meta($post->ID, 'user_id'); ?> <div class="userwall" id=<?php echo $post->ID; ?> > <div class="userwall_delete_post"> <?php $report_userid = get_post_meta($post->ID, 'socialwall_report', true); if (!is_array($report_userid)) { $report_userid = array(); } if (!in_array(get_current_user_id(), $report_userid)) { ?> <i onclick="userwall_report_post(<?php echo $post->ID; ?> ,<?php echo get_current_user_id(); ?> );" class="reportpost fa fa-exclamation-circle"></i> <?php } else { ?> <i style="color:black;opacity: 0.5;cursor:default;" class="fa fa-exclamation-circle"></i> <?php } if ($user_id[0] == get_current_user_id() || is_super_admin(get_current_user_id())) { ?> <i onclick="userwall_delete_post(<?php echo $post->ID; ?> , this);" class="fa fa-trash fa-fw"></i> </div> <?php } ?> <div class="userwall-post-content-img" data-key="profilepicture"><a href="<?php echo $userpro->permalink($user_id[0]); ?> " title="<?php _e('View Profile', 'userpro'); ?> " ><?php echo get_avatar($user_id[0], "60"); ?> </a></div> <div class="userwall-post-content" id="userwall-post-content<?php echo $post->ID; ?> "> <div class="displayname"><a href="<?php echo $userpro->permalink($user_id[0]); ?> "><?php echo userpro_profile_data('display_name', $user_id[0]); ?> </a> <?php $timestamp = strtotime($post->post_date); $new_date = date('d-M-Y h:i', $timestamp); ?> <div class="clear"></div> <div class="post-date"><?php _e("Posted On ", "userpro-userwall"); echo $new_date; ?> </div> <div class="clear"></div><div class="content-text"> <?php if ($post->post_title == "imgpost") { echo '<div class="post-img"><img src="' . $post->post_content . '" style="-moz-user-select: none; border-radius: 10px; margin-right:10px; width: 100% !important;"></div>'; } else { echo html_entity_decode($post->post_content); } ?> </div> </div> </div> <div class="userwall-comment-data-<?php echo $post->ID; ?> " id="userwall-comment" > <?php $like_post = 0; $dislike_post = 0; $like_post = get_post_meta($post->ID, 'socialwall_likes', true); $dislike_post = get_post_meta($post->ID, 'socialwall_dislikes', true); if (!is_array($like_post)) { $like_post = array(); } if (!is_array($dislike_post)) { $dislike_post = array(); } if (!in_array(get_current_user_id(), $like_post) && !in_array(get_current_user_id(), $dislike_post) && is_user_logged_in()) { ?> <div class="userwall_postlikecount_post" id=userwall_postlikecount_post<?php echo $post->ID; ?> > <i onclick="userwall_postlikecount_post(<?php echo $post->ID; ?> ,<?php echo get_current_user_id(); ?> ,<?php if (empty($like_post)) { echo 0; } else { echo count($like_post); } ?> ,<?php if (empty($dislike_post)) { echo 0; } else { echo count($dislike_post); } ?> );" class="socialwall_postlikecount_post fa fa-thumbs-up btn-like-dislike"></i><i class="socialwall_postlikecount_post "><?php if (empty($like_post)) { echo 0; } else { echo count($like_post); } ?> </i> <i onclick="userwall_postdislikecount_post(<?php echo $post->ID; ?> ,<?php echo get_current_user_id(); ?> ,<?php if (empty($dislike_post)) { echo 0; } else { echo count($dislike_post); } ?> ,<?php if (empty($like_post)) { echo 0; } else { echo count($like_post); } ?> );" class="socialwall_postlikecount_post fa fa-thumbs-down btn-like-dislike"></i><i class="socialwall_postlikecount_post "><?php if (empty($dislike_post)) { echo 0; } else { echo count($dislike_post); } ?> </i> </div> <!-- <div class="countlike" id="countlike<?php echo $post->ID; ?> "> <br> </div> --> <?php } else { echo '<i style="color:black;opacity: 0.5;" class="socialwall_postlikecount_post fa fa-thumbs-up"></i>'; ?> <i class="socialwall_postlikecount_post "><?php if (empty($like_post)) { echo 0; } else { echo count($like_post); } ?> </i> <?php echo '<i style="color:black;opacity: 0.5;" class="socialwall_postlikecount_post fa fa-thumbs-down"></i>'; ?> <i class="socialwall_postlikecount_post "><?php if (empty($dislike_post)) { echo 0; } else { echo count($dislike_post); } ?> </i> <?php } ?> <?php $comments = get_post_meta($post->ID, 'user_comment'); foreach ($comments as $comment) { ?> <div class="userwall_comment_data" id="<?php echo isset($i) ? $i : ''; ?> "><?php if ($comment['comment_userid'] == get_current_user_id() || is_super_admin(get_current_user_id())) { ?> <div class=userwall_delete_comment> <i id="delete_comment_<?php echo $post->ID; ?> " onclick="userwall_delete_comment('<?php echo $post->ID; ?> ','<?php echo $comment['comment_content']; ?> ',this);" class="fa fa-trash fa-fw-3"></i></div> <?php } ?> <div class="userwall-comment-content-img" data-key="profilepicture"><a href="<?php echo $userpro->permalink($comment['comment_userid']); ?> " title="<?php _e('View Profile', 'userpro'); ?> " ><?php echo get_avatar($comment['comment_userid'], "40"); ?> </a></div> <div class="userwall-post-content"><div class="displayname"><a href="<?php echo $userpro->permalink($comment['comment_userid']); ?> "><?php echo userpro_profile_data('display_name', $comment['comment_userid']); ?> </a></div> <?php $commenttimestamp = strtotime($comment['comment_date']); $commenttime = date('d-M-Y', $commenttimestamp); ?> <div class="post-date post-comment-date"><?php echo "Commented On " . $commenttime; ?> </div><?php echo "<br><p>" . $comment['comment_content'] . "</p>"; echo "</div></div>"; } ?> </div> <div class="commenttext"> <?php if (is_user_logged_in()) { ?> <textarea id=userwall-comment-<?php echo $post->ID; ?> placeholder="Enter comment and Hit ENTER to submit..." onkeypress="user_post_comment('userwall-comment',<?php echo get_current_user_id(); ?> ,<?php echo $post->ID; ?> ,event);" name="userwall-comment"cols="40" rows="1" style="" class="comment_textarea"></textarea> <?php } ?> </div> </div> <?php } ?> </div> <?php die; } else { echo "hide"; die; } }
<tr valign="top"> <th scope="row"><label for="For All User"><?php _e('Display Wall To Visitors', 'userpro-userwall'); ?> </label></th> <td> <select name="nonloginusers" id="nonloginusers" class="chosen-select" style="width:300px"> <option value="1" <?php selected(1, userpro_userwall_get_option('nonloginusers')); ?> ><?php _e('Yes', 'userpro-userwall'); ?> </option> <option value="0" <?php selected(0, userpro_userwall_get_option('nonloginusers')); ?> ><?php _e('No', 'userpro-userwall'); ?> </option> </select> <span class="description"><?php _e('If this option is set to yes then non logged in users will be able to view the wall', 'userpro-userwall'); ?> </span> </td> </tr> </table>