• Another question:

    Is there a way to pull information from your database to automatically populate user profile fields for registered user on my site?

    I need to pull a value to populate the basic database for wordpress, so that another plugin can pull data which it can only do from the user profiles.

    Let’s say I want to populate the field “Main Interest” in the user profiles based on what main interest they submit in a cf7 form to cfdb.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    You would have to add some code to a CFDB hook to grab a form submission when it arrives and save data in the profile. See: http://cfdbplugin.com/?page_id=747

    Thread Starter vingstaf

    (@vingstaf)

    Alrighty! I think this would be a smoother solution to one of my previous issues aswell, regarding viewing database entries for specific entries seemingly untied to one’s user account. Would this sort of code work for example?

    
    // My form filter
    function myFilter($formData){
        $formName = 'testform'; // change this to your form's name
        // Can I set up alot of what-ifs like this?
        if ($formData->posted_data['group']->group-a) {
            $formData->posted_data['leader'] = 
                //Sorry for the following brutal make-belief line. Regards, non-techy. I want the following line to print a registered user with a user profile field named user_leader_of that reads exactly the same as the submission in ['group'], in this case group-a.
                (%user_leader_of% == group-a)
        return $formData;
    }
     
    add_filter('cfdb_form_data', 'myFilter');
    

    Like, is there an action that can fetch a line from a user profile, checking whether a submitted field in the cf7 form corresponds to a field in a user profile. If doable, this would make it so much cleaner for me, if the form could automatically create this field in the background, so that a user with user_leader_of set to group-a can then navigate the db with correct rights.

    Plugin Author Michael Simpson

    (@msimpson)

    $formData->posted_data['group'] will be a string not an object, so the ->group-a syntax will not work. I don’t follow your intent. Maybe you mean == 'group-a' ?

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

The topic ‘Show db values in user profiles’ is closed to new replies.