cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
unable to get the post authour details in the particular form
October 15, 2009
8:37 am
Guest

Please replace the ??? with your data!

  • URL to the FORM: http://???
  • The browser used: firefox
  • cforms version: latest
  • Your Wordpress version: 2.8.4

[desc]:
_

i am unable to get the post author details in a particular cform.

i have attached <?php  insert_cform('Appraisal Form'); ?> in that post template page. and i want to pick dynamically post author.

and i am using the code in myfunctions.php.

function my_cforms_ajax_filter($params) {

    ### triggers on your third form
    if ( $params['id']=='6' ) {

            ### do something with field #1
            ### (! for ajax, all form fields are counted sequentially! !)
            //$params['field_1'] = 'Mr./Mrs. '.$params['field_1'];

    global $authordata;
    $nick = get_the_author();
    $mail = get_the_author_email();

            @mail('gurpreet.singh697@gmail.com', 'cforms my_filter_Ajax test', 'Form data array (Ajax):'.$mail, 'From: your@blog.com');
    //@mail('gurpreet.singh697@gmail.com', 'cforms my_filter_Ajax test', 'Form data array (Ajax):'.$userdata->ID, 'From: your@blog.com');

    }
    return $params;

}

Thanks

Gurpreet

October 15, 2009
7:14 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

the problem is that you're calling the get_the_a..outside the WP LOOP.

the ajax call is a individual back end call and thus you need to consider passing on (via a hidden field) the post ID, which needs to be used to set the context of your WP calls.

  1. you can simply enable '' under Core Options which will add such a hidden field.
  2. in your routine add global $Ajaxpid;
  3. and use it to set the context of a WP call
Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3762

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5361

Posts: 18742

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)