Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hey – not sure if it’ll work for you, but i had a similar issue – the cube points showed up in the admin bar, but i got a 404 when i clicked the link and the “Points” menu was gone from my profiles.

    This is how i fixed it:

    Open bp-cubepoint-core.php

    Go to line 44, it originally looks like this:

    global $bp, $wpdb;
    
    	$bp->cubepoint->id = 'cubepoint';
    	$bp->cubepoint->table_name = $wpdb->base_prefix . 'cubepoints';
    	$bp->cubepoint->table_name = $wpdb->prefix . 'cubepoints';

    change it to this:

    global $bp, $wpdb;
    
    	//The following 3 lines fix the 1.7 upgrade
    	if( !is_object( $bp->cubepoint ) ) {
    		 $bp->cubepoint = new stdClass;
    	}	
    
    	$bp->cubepoint->id = 'cubepoint';
    	$bp->cubepoint->table_name = $wpdb->base_prefix . 'cubepoints';
    	$bp->cubepoint->table_name = $wpdb->prefix . 'cubepoints';

    I haven’t noticed any other errors since I made that change. Hope it helps.

    hey Matt, are you talking about this hook: vfb_action_confirmation?

    Glad I could help. I’m a VFB newbie like yourself and am just trying to help others while I search for answers myself.

    just for clarification i’m using VFB pro 2.2.4 so it may be a different line number or even file if you’re not using that version.

    I just started using VFB a week ago and am totally impressed with all that Matt has put into it. It’s incredible and worth much more than the $10. Many kudos to him.

    ok – if you’re using vfb pro, in form-output.php on line 32 it says:

    $output = $this->confirmation();

    You can write your own filter on that line like this:

    $output = apply_filters( 'vfb_get_confirmation', $this->confirmation(), $form_id);

    And in your functions.php file, you can add this:

    add_filter( 'vfb_get_confirmation', 'my_confirmation_function', 10, 2 );
    
    function my_confirmation_function( $message, $form_id ) {
         if ( 3 === $form_id ) {
              return $message . '<br /> Today's date is: ' . date("F j, Y, g:i a");
         }
    }

    This is untested, but it’s how you would make your own filter using Matt’s current code.

    Also, if you haven’t invested the $10 to upgrade to pro, you should do that.

    First, i edited my response. 2nd, adding filters happens in your theme’s functions.php file (or in a custom plugin).

    I’m not Matt, but you can probably use this filter to achieve what you’re trying:

    vfb_prepend_confirmation

    EDIT: Nevermind i didn’t read his documentation well enough. sorry for misleading you.

    balboj,

    If you look at the code i posted, you’ll see that the field_id to switch on is not ‘vfb-11’ it is just 11 without quotation marks.

    If you look at the vfb_get_name() function, you’ll see that it returns “$first $last”. You should be able to take that functionality and split it into 2 separate fields.

    let me paste it again and see if it’ll keep the formatting of my code this time:

    function vfb_get_name(){
    	$current_user = wp_get_current_user();
    
        if ( !empty( $current_user->user_firstname ) && empty( $current_user->user_lastname ) )
            $first = $current_user->user_firstname;
        else if ( empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) )
            $last = $current_user->user_lastname;
        else if ( !empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) ) {
            $first = $current_user->user_firstname;
            $last = $current_user->user_lastname;
        }
    
        return "$first $last";
    }

    balboj,

    I filter the data based on the form_id and field_id. Here’s an example of what I’m using. This will grow rather quickly if i keep going this route – this’d be better if they were just parameters in the shortcode, but that’s not implemented:

    add_filter( ‘vfb_field_default’, ‘vfb_filter_field_default’, 10, 4 );

    function vfb_filter_field_default( $default, $field_type, $field_id, $form_id ){

    switch ( $field_type ) :

    case ‘name’:

    if ( is_user_logged_in() ) :

    return vfb_get_name();

    endif;

    break;
    case ’email’:

    return vfb_get_email();
    // do nothing

    break;
    endswitch;

    switch ( $form_id ):

    case 3: // Job Application Form

    switch ( $field_id ):

    case 41: //Hidden Name field
    return vfb_get_name(); // I only allow logged in users access to this form.
    break;
    endswitch;

    break;

    case 5: // Test form
    switch ( $field_id ):

    case 57: // Hidden Name
    return vfb_get_name();
    break;
    case 58: // Hidden Email
    return vfb_get_email();
    break;
    case 59: // Visible Text field
    return ‘abcdefg’;
    break;

    endswitch;

    break;

    endswitch;

    return $default;
    }

    function vfb_get_name(){
    $current_user = wp_get_current_user();

    if ( !empty( $current_user->user_firstname ) && empty( $current_user->user_lastname ) )
    $first = $current_user->user_firstname;
    else if ( empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) )
    $last = $current_user->user_lastname;
    else if ( !empty( $current_user->user_firstname ) && !empty( $current_user->user_lastname ) ) {
    $first = $current_user->user_firstname;
    $last = $current_user->user_lastname;
    }

    return “$first $last”;
    }

    function vfb_get_email(){
    if ( is_user_logged_in() ) :
    $current_user = wp_get_current_user();
    return $current_user->user_email;
    endif;

    return “”;
    }

    Hope that helps.

    Thread Starter farvgnugn

    (@farvgnugn)

    Hey Matt – I found the problem – the hidden field doesnt handle the default value at all. Here’s the modficiation – line 832 of form-output.php:

    before:

    case ‘custom’ :
    $val = trim( stripslashes( $opts_vals[1] ) );
    break;

    after:

    case ‘custom’ :
    if ( !empty( $default ) ) {
    $val = $default;
    } else {
    $val = trim( stripslashes( $opts_vals[1] ) );
    }
    break;

    Think you could add this to the next version?

    Hey – i hate to kidnap the forum, but i have a question along the same lines. I’ve got it populating fields, but I can’t get it to populate hidden fields.

    I return the default value just like for the rest of the fields, but my output is the following:

    <input type=”hidden” name=”vfb-59″ id=”vfb-hidden-59″ value=”” class=”vfb-text “>

    Thanks for your help Matthew. Great plugin by the way (just bought pro yesterday).

Viewing 11 replies - 1 through 11 (of 11 total)