• For everyone who was wondering why the shortcode always appears at the top of the page, how to remove the <strong> or the £ symbol before the amount, I am here to provide some solutions for you, since I’ve been looking into it for days and the author didn’t seem very responsive.

    The reason why the shortcode appears always at the top is because author’s shortcode function ends with echo and not with a return.

    I am sharing you the following code. It will print the shortcode whenever you put it, with no <strong> or currency symbol. Simply add this code into your functions.php. Make sure it is in the CHILD THEME, otherwise it will be overwritten at your next theme’s update.

    add_shortcode( 'displaywalletcredits', 'displayWalletCredits' );
    function displayWalletCredits ( $atts ) {
        /** do not run if the user is not logged into WP */
        if(! is_user_logged_in() )
            return false;
    
        /** shortcode attribute functionality */
        extract( shortcode_atts( array (
            'display_username' => true,
            'separator' => ':',
            'username_type' => 'display_name'
        ), $atts ) );
    
        /** @var object the current user object */
        $current_user = wp_get_current_user();
    
        /** deturmine whether to show the username or not */
        if($display_username === 'true') {
    
            /** which type of user name to display */
            switch($username_type)
            {
                case 'first_name':
                    $output .= $current_user->first_name;
                    break;
    
                case 'last_name':
                    $output .= $current_user->last_name;
                    break;
    
                case 'full_name':
                    $output .= $current_user->first_name . ' ' . $current_user->last_name;
                    break;
    
                default:
                    $output .= $current_user->display_name;
            }
        }
    
        $hasBalance = get_user_meta(get_current_user_id(), '_uw_balance', true);
        if (!empty($hasBalance)) {
        	$output .= ($hasBalance);
        } else {
        	update_user_meta( get_current_user_id(), "_uw_balance", "0.00");
        	$output .= get_user_meta(get_current_user_id(), '_uw_balance', true);
        }
    
        return $output;
    }

    Then call the user’s amount with [displaywalletcredits].

    Enjoy.

    https://www.ads-software.com/plugins/user-waller-credit-system/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey wiredmark,

    Thanks a million for this. I’m having a small issue though, i can’t get this to work on my theme with <?php do_shortcode('')?> any idea why ?

    Best regards,
    Pedro

    Thread Starter wiredmark

    (@wiredmark)

    Hi Pedro,
    When you say it “doesn’t work” you don’t give enough informations, what do you mean exactly? Do you get an error? Tell me exactly the steps you are doing.

    Marcello Silvestri

    Hi Wiredmark,
    Thank you for your fix to this issue! However after placing your snippet in my functions.php file, the shortcode still displays the balance stuck at the top of the page….any ideas what may be going wrong?

    • This reply was modified 8 years, 2 months ago by krisric345.

    Hi.
    After some configuration, I got the Virtual Balance to show where I wanted.
    but the [displaywalletcredits]. still default to the top of the page.

    Also, I did some testing on purchases of the VC. When you purchase the credit with “pay later /CPD or bank transfer” it shouldn’t credit their accounts until I approve and complete the order.

    The Credit is immediately credited to the user without me approving the transaction.
    How can we make sure that the credit is not added to the member until we approve/complete the order.

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Solution: shortcode on top of the page remove bold remove symbol’ is closed to new replies.