Support » Plugin: CubePoints » [Plugin: CubePoints] History of my points in one page

  • Hello,
    i have this:

    /** My Points Module */
    cp_module_register(__('My Points', 'cp') , 'mypoints' , '1.0', 'CubePoints', '', '' , __('Allow users to see a history of their point transactions.', 'cp'), 1);
    	add_action('admin_print_scripts-cubepoints_page_cp_modules_mypoints_admin', 'cp_datatables_script');
    	add_action('admin_print_styles-cubepoints_page_cp_modules_mypoints_admin', 'cp_datatables_style');
    		echo '<div class="wrap">';
    		echo '<h2>CubePoints - ' . __('My Points', 'cp') . '</h2>';
    		echo __('Manage and view information about your points.', 'cp');
    		echo '<br /><br />';
    		echo '<div style="background:#EFEFEF;display:inline-block;margin-right:25px;"><div style="float:left;font-size:17px;font-weight:bold;background:#E0E0E0;padding:18px;color:#565656;">' . __('My Points', 'cp') . ':</div><div style="float:left;padding:18px;font-size:20px;">' . cp_getPoints(cp_currentUser()) . '</div></div>';
    			echo '<div style="background:#EFEFEF;display:inline-block;"><div style="float:left;font-size:17px;font-weight:bold;background:#E0E0E0;padding:18px;color:#565656;">' . __('My Rank', 'cp') . ':</div><div style="float:left;padding:18px;font-size:20px;">' . cp_module_ranks_getRank(cp_currentUser()) . '</div></div>';
    		echo '<div style="clear:both;"></div><br />';
    		echo '<p style="font-weight:bold;">' . __('Your recent point transactions:', 'cp') . '</p>';
    		cp_show_logs(cp_currentUser(), 15 , false);
    		echo '</div>';

    If i insert it.. i can add what i want (my points) in one page with template.
    Now i want add it without template but with only one shortcode. How to do it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Gabriel



    Just add a shortcode to your module i.e:

    add_shortcode( 'myshortcode', 'myshortcode_function' );
    function myshortcode_function( $atts )
    	// Extract Attributes if you want any
    	extract( shortcode_atts( array(), $atts ) );
    	// Your code here

    Just remember that if you place it inside if(cp_module_activated('mypoints')){ } it (the shortcode) will only be available when the module is active.

    Thank you but the shortcorde how is?



    The shortcode would be [myshortcode]. If you want to pass on attributes it would be [myshortcode number=”1″]. In this example number would be the attribute.

    You can find more information about Shortcodes here:

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: CubePoints] History of my points in one page’ is closed to new replies.