Support » Plugin: BuddyPress Registration Options » Send all registration fields in admin approval email

  • Resolved AJ

    (@permaculturetreegeek)


    Great plugin! So far its working in WP 3.8.

    I am creating an application process and it would be great if all the information in the registration form could be sent with the email.

    When the admin gets a registration request –>

    XXX would like to become a member of your website, to accept or reject their request please go to – Link.

    then add…

    ALL the registration form fields here.

    Thanks

    http://wordpress.org/plugins/bp-registration-options/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure that’s something we could realistically predict, given the custom form from your end.

    However, I know we use the wp_mail() function and inside that is the wp_mail filter that you could hook onto to add your extra fields to before emailing.

    AJ

    (@permaculturetreegeek)

    Hmm, the extra fields are all created by Buddypress from the extend profiles component. I wonder about creating an array that just grabs everything and hook that into the email?

    Something like this?

    $current_user = wp_get_current_user();
        $current_user_id = $current_user->ID;
        bp_profile_field_data( array('user_id'=>$current_user_id, $user_fields=> array() ));
    	   foreach($user_fields as $name=>$value) {
    
            echo "<strong>".$name."</strong>"."  =>  ";
    
            foreach($value as $nameAr=>$valueAr) {
                    echo "<br />     ";
                    echo $nameAr."  =>  ";
                    echo var_dump($valueAr);
            }
    		}
    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Worth a try, I can’t say for sure how that will come out within the email, without actually adding it myself to a test instance. If it works though, go for it 🙂

    AJ

    (@permaculturetreegeek)

    I’m not sure how to add it to the email. Do you have any tips on that?
    Thanks!

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Are you familiar with WP hooks at all? Specifically filters?

    You can intercept the “message” with the wp_mail filter and append your own stuff.

    http://adambrown.info/p/wp_hooks/hook/wp_mail?version=3.6&file=wp-includes/pluggable.php

    AJ

    (@permaculturetreegeek)

    I understand hooks and filters when I read them, but writing is still a bit beyond me.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    here’s an example of what I meant, with a bit of comments.

    add_filter( 'wp_mail', 'myfilter' );
    function myfilter( $values ) {
    	/*
    	$values will be an array.
    	$values['to']
    	$values['subject']
    	$values['message']
    	$values['headers']
    	$values['attachments']
    	 */
    
    	//Do whatever you have to do here to gather what extra content you want to add. You can append to the message like below, or you can even replace completely.
    	$values['message'] = $values['message'] . ' This is appended data to the message.';
    
    	return $values;
    }
    AJ

    (@permaculturetreegeek)

    Cool thanks!

    Question: How do I know which mail is the one sent by the plugin?

    That looks like it will add extra stuff to all emails sent.

    Is it possible to filter it to add stuff to specific emails only?

    Thanks.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    No great way, but you could use php’s strpos() to check if either of the following are in the subject: ‘Banned member registration attempt’
    ‘New Member Request’

    As an aside, I may add a filter around some of this stuff in the future so people could intercept. This would be a good place.

    AJ

    (@permaculturetreegeek)

    OK thanks, Ill see if I can get it to work.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Send all registration fields in admin approval email’ is closed to new replies.