Posts

Showing posts from August, 2014

Hide Admin Menu Items from Specific Users in Wordpress

If you develop a site for a client add this function to your themes functions.php file and change the user ID (in the example below it's 3) to the ID of the user you want to hide certain admin menu items. You can get the user's ID by hovering over the users name and looking for "user_id=3" in the bottom left corner of your browser or click on the user name and check the ID in the URL In the function below I've added all the admin page names for reference but commented out // the pages I want the user to see. function remove_menus(){   $user_ID = get_current_user_id();      if ($user_ID == '3') {      //remove_menu_page( 'index.php' );                  //Dashboard   remove_menu_page( 'edit.php' );                   //Posts   //remove_menu_page( 'upload.php' );                 //Media   //remove_menu_page( 'edit.php?post_type=page' );    //Pages   remove_menu_page( 'edit-comments.php' );          //Comm

Wordpress Contact Form 7 manually add Aweber subscribers in PHP

Add this function to the Contact Form 7 functions.php file in the /wp-content/plugins/contact-form-7/includes folder. Works with Contact Form 7 v3.9 upwards Change the details to your Aweber list name, meta ad tracking, form id etc. The redirect and redirect_onlist doesn't actually go the page specified (can be removed if you like) Note: the user still has to confirm the subscription via email to be successfully added to the Aweber list function process_aweber($cf7) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $name = $_POST['your-name']; $email = $_POST['your-email']; $str= 'meta_web_form_id='.urlencode('000000000'). '&meta_split_id='.urlencode(''). '&meta_redirect_onlist='.urlencode('http://www.yourdomain.co.za'). '&meta_tooltip='.urlencode(''). '&listname='.urlencode('yourListIDhere'). 

Get Contact Form 7 Posted Data in PHP - Updated for v3.9

Use this function...added to your Wordpress theme's functions.php file This PHP function is run before the form sends an email.  You can use this to store the form data in a database or post to another system. The old $cf7->posted_data['your-email'] doesn't collect the form posted data in the new version of Wordpress Contact Form 7 v3.9+ function something_before_sending_email($cf7) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $name = $_POST['your-name']; $email = $_POST['your-email']; } } add_action('wpcf7_before_send_mail',something_before_sending_email'); Thanks to Paulo's post here: http://getlostandwander.blogspot.com/2014/07/contact-form-7-new-way-to-save-data.html