function EWD_FEUP_Filter_Page_Content($content) { global $wpdb, $ewd_feup_user_table_name, $ewd_feup_levels_table_name; $ID = get_the_ID(); $FEUP_Level_Type = get_post_meta($ID, "ewd-feup-level-type-dropdown", true); $FEUP_Level = get_post_meta($ID, "ewd-feup-level-dropdown", true); if ($FEUP_Level > 0) { $Delete_Content = "Yes"; $User = new FEUP_User(); if ($User->Is_Logged_In()) { $Level_ID = $wpdb->get_var("SELECT Level_ID FROM {$ewd_feup_user_table_name} WHERE User_ID='" . $User->Get_User_ID() . "'"); $Level = $wpdb->get_var("SELECT Level_Privilege FROM {$ewd_feup_levels_table_name} WHERE Level_ID='" . $Level_ID . "'"); if ($FEUP_Level_Type == "minimum_level") { if ($Level >= $FEUP_Level) { $Delete_Content = "No"; } } elseif ($FEUP_Level_Type == "level") { if ($Level == $FEUP_Level) { $Delete_Content = "No"; } } elseif ($FEUP_Level_Type == "maximum_level") { if ($Level <= $FEUP_Level) { $Delete_Content = "No"; } } } if ($Delete_Content == "Yes") { $content = __("Please log in to access this content.", 'EWD_FEUP'); } } return $content; }
******************************************/ // Test if a user is logged in if ($FEUP->Is_Logged_In()) { // Display the menu named "Logged In Menu" if they are (created under "Appearances" -> "Menus" of the WordPress Admin) wp_nav_menu(array('menu' => 'Logged In Menu')); } else { // Display the menu named "Logged Out Menu" if they aren't wp_nav_menu(array('menu' => 'Logged Out Menu')); } /****************************************** * DISPLAY POST BASED ON A USER'S INTERESTS ******************************************/ // Get the field value for the "Interests" field $Interests_String = $FEUP->Get_Field_Value("Interests"); // Turn the string containing a user's interests into an array $Interests = explode(",", $Interests_String); // Check if lighting is in the array, and display posts in the "Lighting" category if it is if (in_array("Lighting", $Interests)) { // this user is interested in lighting, display the lighting posts category here } /***************************************** * THE FOUR HELPER FUNCTIONS *****************************************/ // Retrieve the user's ID $User_ID = $FEUP->Get_User_ID(); // Retrieve the user's username $Username = $FEUP->Get_Username(); // Retrieve the user's username in a different way $Same_Username = $FEUP->Get_User_Name_For_ID($User_ID); // Retrieve the value for the field named "Interests", for the user with ID equal to $User_ID $Field_Value = $FEUP->Get_Field_Value_For_ID("Interests", $User_ID);
function EWD_FEUP_Admin_Head() { global $EWD_FEUP_Full_Version; $Track_Events = get_option("EWD_FEUP_Track_Events"); $User = new FEUP_User(); if ($User->Is_Logged_In() and $EWD_FEUP_Full_Version == "Yes" and $Track_Events == "Yes") { echo "<script>var User_ID = " . $User->Get_User_ID() . ";\n"; echo "if (typeof(ajaxurl) == 'undefined' || ajaxurl === null) {"; echo "var ajaxurl = '" . admin_url('admin-ajax.php') . "';\n"; echo "}"; echo "</script>"; } }