Pages

Monday, December 31, 2012

Show more comments per page in wordpress backend

I have a very old site which I hardly bother to update. I opened the dashboard after about several months only to see that there are 653 comments. 90% of them were spam messages. Now I had to delete them or mark them as spam.

Wordpress prior to 2.8 versions used to show only 20 comments per page. But this limit is no more a limit from versions after 2.8.

If you want to increase the number of comments to be listed per page, then  follow these simple instructions:


  1. Open Comments in your wp-admin dashboard
  2. Click on the Screen Options on the right-top corner 
  3. It will open a slide-down menu.
  4. Change the number from 20 to any number that you want.
That's it. You get as many comments as you want in one page and avoid pagination process. Now you can delete, spam it or approve it in bulk very easily.

Saturday, December 29, 2012

Add Media Links in Activity Stream

Buddypress Media is a great plugin authored by rtCamp. They enable site users to upload media in albums. Media includes music, videos and photos.

However, the plugin lacks one important part - Adding media from the front end. Much like how another plugin Activity Plus does. Activity Plus lacks what BP Media provides - and that is - organizing into albums and having them stored for future use right on the members pages.

I thought of marrying both. i.e bringing BP media on the front-page where Activity Updates are posted.

//add media links

function add_media_links(){

    global $bp, $current_user;;

if (is_user_logged_in()) {

echo '<div style="float:right; font-weight:bold;">';

echo '<a href="'.$bp->root_domain . '/members/' . $current_user->user_login  .'/media/" style="color:black; padding-right:10px">Upload</a>';

echo '<a href="'.$bp->root_domain . '/members/' . $current_user->user_login  .'/albums/" style="color:black; padding-right:10px">My Albums</a>';

echo '<a href="'.$bp->root_domain . '/members/' . $current_user->user_login  .'/photos/" style="color:black; padding-right:10px">My Photos</a>';

echo '<a href="'.$bp->root_domain . '/members/' . $current_user->user_login  .'/videos/" style="color:black; padding-right:10px">My Videos</a>';

echo '<a href="'.$bp->root_domain . '/members/' . $current_user->user_login  .'/music/" style="color:black; padding-right:10px">My Music</a>';

echo '</div>';

}

else {

echo '<div style="float:right; font-weight:bold;">';

echo '<a href="'.$bp->root_domain . '/login/" style="color:black; padding-right:10px">Upload</a>';

echo '<a href="'.$bp->root_domain . '/login/" style="color:black; padding-right:10px">My Albums</a>';

echo '<a href="'.$bp->root_domain . '/login/" style="color:black; padding-right:10px">My Photos</a>';

echo '<a href="'.$bp->root_domain . '/login/" style="color:black; padding-right:10px">My Videos</a>';

echo '<a href="'.$bp->root_domain . '/login/" style="color:black; padding-right:10px">My Music</a>';

echo '</div>';}

return;

}

add_filter('bp_before_directory_activity_content',add_media_links');

?>
You may want to add this to your functions.php file.

This code, specially the last line of the code adds a filter such that whenever bp_before_directory_activity_content function is triggered, my own custom function add_media_links will trigger automatically where in, if the user is logged in, it provides direct links to the media upload as it takes $current_user->username to take them to their own page for media uploads. And if its just a visitor, these links will redirect to the login page.



You can see this in my site which is live in action at: DublinWala.Com