Archive for April, 2012

Customizing & Fixing Donate module in CubePoints Reputation system on WP

First of all I don't like the word "donate" in context of reputation/relations.
Just imagine, user thinks and want to say: "Hey, Bro! Thanks! Take this 10 points to your rep!"
And here we do offer him to tell another phrase: "Hello. Please take my handout of 10 points..."
I think this alternatives are much better: Add/Share/Give points, say Thanks!

We need passing username to the first field ("Recipient:") and value="10" to field "Amount:" (or 5, or 20 or any value you consider better).

Find function cp_module_donate() in the script /wp-content/plugins/cubepoints/modules/donate/donate.js
and function cubepoints_bp_profile() in the file /wp-content/plugins/cubepoints-buddypress-integration/includes/bp-cubepoint-functions.php

We will just add "username" variable to cp_module_donate()
I've added value="'+username+'" to the first input, and value="10" to second input.
function cp_module_donate(){ changed to function cp_module_donate(username){

Here is my result for mentioned function (donate.js file):

function cp_module_donate(username){
  confirmation = cp_donate.confirmation;
  thebox = new Boxy('<form name="cp_donate" id="cp_donate" method="post" onsubmit="Boxy.confirm(confirmation,function(){cp_module_donate_do();});return false;"><label for="cp_recipient">'+cp_donate.recipient+':</label><br /><input type="text" id="cp_recipient" name="cp_recipient" style="width:300px;" value="'+username+'" /><br /><br /><label for="cp_points">'+cp_donate.amount+':</label><br /><input type="text" id="cp_points" name="cp_points" style="width:300px;" value="10" /><br /><br /><label for="cp_message">'+cp_donate.message+':</label><br /><textarea id="cp_message" name="cp_message" style="width:300px;height:50px;"></textarea><br /><br /><input type="submit" value="'+cp_donate.donate_points+'" style="width:300px;" /></form>', {title: cp_donate.donate, modal: true});

Now we need set variable "username" when cp_module_donate(username) function was called.
It should look somehow like this:

onclick="Javascript:cp_module_donate('<?php echo bp_core_get_username($bp->displayed_user->id); ?>');"

In addition I've changed title for link: title=""
And removed "Rank - " from user-rank. I think word "Newbie" is enough and looks better than "Rank - Newbie".

Ok, here is result of customized function cubepoints_bp_profile() (file /wp-content/plugins/cubepoints-buddypress-integration/includes/bp-cubepoint-functions.php)

function cubepoints_bp_profile() {
	global $bp;
	if(function_exists('cp_displayPoints')){ ?>
		<span class="cubepoints_buddypress"><?php echo cp_displayPoints($bp->displayed_user->id); ?></span>
	<?php }
		if (is_user_logged_in()) { ?>
			<span class="cupepoints_buddypress_donate"><a href="#" title="<?php _e('Share Points(say Thanks!)', 'cp_buddypress'); ?>" onclick="Javascript:cp_module_donate('<?php echo bp_core_get_username($bp->displayed_user->id); ?>');" class="thickbox cp_donateLink"><?php _e('Add Points', 'cp_buddypress'); ?></a></span>
	<?php } }
	if(cp_module_activated('ranks')){ ?>
		<span class="cupepoints_buddypress_rank"><?php /*_e('Rank', 'cp_buddypress');*/ ?><?php echo cp_module_ranks_getRank($bp->displayed_user->id); ?></span>
	<?php }

Additionally you can change output for donation popup window.
Check file /wp-content/plugins/cubepoints/modules/donate/donate.php
Here is example of customized values:

wp_localize_script( 'cp_donate_script', 'cp_donate', array(
  confirmation=>__('Are you sure you want to share your points?', 'cp'),
  recipient=>__('Recipient', 'cp'),
  message=>__('Message', 'cp'),
  amount=>__('Amount (10 points should be Ok)', 'cp'),
  donate_points=>__('Submit!', 'cp'),
  donate=>__('Add Points from your Score', 'cp')
) );

Any questions or suggestions?

VN:F [1.9.17_1161]
Rating: 7.8/10 (4 votes cast)
permalinkRead More CommentComments (0) CatUncategorized

Implementing CubePoints Reputation and Rank in WP comments

After installing CubePoints(+CubePoints Buddypress Integration) plugin I was disappointed that I didn't found reputation points and ranks for users in their comments on blog and bbpress forum. I think that this is important part of such plugin - show user's reputation to public.
After couples of hours of searching for solution, I did found only that. But nobody told there how to embed this correctly in WP.
Anyway I've found solution after reading some topics and WP functions descriptions. Here is result:

CubePoints and Ranks in WordPress Comments
Read the rest of this entry »

VN:F [1.9.17_1161]
Rating: 8.8/10 (9 votes cast)
permalinkRead More CommentComments (11) CatUncategorized

Important plugins for bbPress 2.0

bbPress 2.0 Released on September 21, 2011. Version 2.1 in progress.
If you are setting up new bbPress installation you wouldn't use old version for sure.
But the problem is that most of plugins are developed for bbPress 0.9 and wouldn't work on 2.0 version.
Developers do not hurry update their plugins... :(

Here is some really useful plugins for bbPress 2.0 that I'd like to share with you.


  • bbPress Quotes
    Gives the ability to quote bbPress forum topics and replies. A quote button appears to the end of replies so users can easily quote another user.
  • bbPress Moderation
    Add the ability to moderate and approve new topics and replies in the bbPress V2.0 plugin
  • bbPress Post Toolbar
    Enables uploading/embedding images in a bbPress post. User can embed video from YouTube, Metacafe, Vimeo (and others) with shortcodes.
  • bbPress2 BBCode
    This plugin adds support for popular bbcode forum code to posts, comments, pages, bbpress 2.0 forum posts and buddypress activity and group forum post.
    It was tested and it works. But it doesn't offer any script+buttons for marking the text. You can setup simple BBCode Editor in JS for that (here is instruction). But there is no big sense while bbPress Post Toolbar works pretty good.
    But BBCode Editor is a really simple solution, customizable, can be implemented everywhere and works like a charm. TinyMCE, CKEditor are brutal in comparison to this.

Read the rest of this entry »

VN:F [1.9.17_1161]
Rating: 5.5/10 (2 votes cast)
permalinkRead More CommentComments (0) CatUncategorized

AddThis Vertical Bar position relative to the page content

I was trying to setup Sociable plugin for WP. Skyscrapper didn't work.
I remember about AddThis buttons and found that they do offer Vertical Bar now.

Instruction there is very poor, but vertical floating bar with social buttons is very popular among bloggers! And they really offer webmasters set position of sharing bar relative to the left top corner of visitors' browsers . :)
Most of sites I visit has centered body, I think you too. And what if I want place this bar to the right of content???
According to the logic We must post notice on our sites like this: "Please change resolution of your monitor to 1280x1024 for better view."
Crap! :) Read the rest of this entry »

VN:F [1.9.17_1161]
Rating: 8.5/10 (8 votes cast)
permalinkRead More CommentComments (2) CatUncategorized

Simple PHP code for getting value of current URL

Today I've started making sitewide login form for WordPress based site with specific scripts.
wp-login.php uses redirect_to variable. That mean - after login user can be redirected back to the page where he was before. We must send this info to wp-login.php

So, for complete my login form I needed the value of current URL.
WP has function get_permalink(), but I needed something like this for script that is not under WP control.
And get_permalink() will cut GET request. For example if the user is on the page after login he will be redirected to

There are lots of variants of code I found. For example specific functions like this or this.
That's too huge code for me and mostly for those who uses specific ports maybe.
But all I need is just the value of the URL in user address bar!

I found pretty good code here.
It checks the URL only if it HTTP or HTTPS, and that's enough!
After little minimization I've got this:

$url = (!empty($_SERVER['HTTPS'])) ? "https://" : "http://";
VN:F [1.9.17_1161]
Rating: 5.5/10 (2 votes cast)
permalinkRead More CommentComments (0) CatUncategorized

Creating ribbon-style button with Photoshop (best for Join-Now/Register signs)

Recently I was looking for attractive "Join Now!" button.
I was trying to find Photoshop tutorial with keywords like strip, tape and etc. Got some interesting options for ribbon word.
...but nothing what I need.

And rapidly found this button that could perfectly fit in my layout. It's a vector image, but it's possible to make something like that with Photoshop.
I was googling for any tutorial for about an hour, but got nothing similar.
I decided to make it myself using all my little experience with Photoshop.
Here is what I've made in the end:

Ribbon Button example
Read the rest of this entry »

VN:F [1.9.17_1161]
Rating: 6.7/10 (3 votes cast)
permalinkRead More CommentComments (1) CatUncategorized
CSS Template by RamblingSoul | Tomodachi theme by Theme Lab