function wpuf_edit_users() { //if user is logged in if (is_user_logged_in()) { //this user can edit the users if (current_user_can('edit_users')) { $action = isset($_GET['action']) ? $_GET['action'] : 'show'; $user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : 0; $userdata = get_userdata($user_id); switch ($action) { case 'edit': //if user exists if ($user_id && $userdata) { wpuf_user_edit_profile_form($user_id); } else { printf(__("Utilisateur n'existe pas", 'wpuf')); } break; case 'wpuf_add_user': wpuf_add_user(); break; default: wpuf_show_users(); } } else { // user don't have any permission printf(__("You don't have permission for this purpose", 'wpuf')); } } else { //user is not logged in //printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( '', false ) ); Redirect_('login'); die; } }
/** * Handles the edit post shortcode * * @return string generated form by the plugin */ function wpuf_edit_post_shorcode() { ob_start(); if (is_user_logged_in()) { wpuf_edit_post(); } else { Redirect_('login'); die; //printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( '', false ) ); } $content = ob_get_contents(); ob_end_clean(); return $content; }
/** * Handles the add projet shortcode * * @author Tareq Hasan * @package WP User Frontend * @param $atts */ function wpuf_add_message_shorcode($atts) { extract(shortcode_atts(array('post_type' => 'message'), $atts)); ob_start(); if (is_user_logged_in()) { wpuf_add_message($post_type); } else { Redirect_('login'); wp_die(); // printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( get_permalink(), false ) ); } $content = ob_get_contents(); ob_end_clean(); return $content; }
/** * Handle's user dashboard functionality * * Insert shortcode [wpuf_dashboard] in a page to * show the user dashboard * * @since Version 0.1 * @author Tareq Hasan * @package WP User Frontend */ function wpuf_all_dash_attente($atts) { extract(shortcode_atts(array('post_type' => 'projet'), $atts)); ob_start(); if (is_user_logged_in()) { wpuf_user_dashboard_attente_list($post_type); } else { Redirect_('login'); die; //printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( '', false ) ); } $content = ob_get_contents(); ob_end_clean(); return $content; }
<?php /** * @package Private Messages For WordPress * * @author: Rilwis * @url: http://www.deluxeblogtips.com * @email: rilwis@gmail.com Template Name: Private Messages */ ?> <?php if (!is_user_logged_in()) { Redirect_('login'); die; } get_header(); ?> <div margin-left: 10%; "> <fieldset style="border:groove; width: 50%; margin-left: 10%; margin-bottom: 1%;"> <a href="javascript:void(0);" onclick="pmSwitch('pm-send');">Nouveau Message</a> | <a href="javascript:void(0);" onclick="pmSwitch('pm-inbox');">Boite de reception</a> | <a href="javascript:void(0);" onclick="pmSwitch('pm-outbox');">Messages Envoyés</a> </fieldset> <script type="text/javascript"> // Switch between send page, inbox and outbox function pmSwitch(page) { document.getElementById('pm-send').style.display = 'none'; document.getElementById('pm-inbox').style.display = 'none'; document.getElementById('pm-outbox').style.display = 'none';
function listerfav() { global $wpdb; $precedent = $_SERVER['REQUEST_URI']; $user = get_current_user_id(); if ($user == 0) { $_SESSION['context'] = $precedent; Redirect_('login'); die; } else { $choisis = avoir_favoris(); ?> <div id="primary"> <?php if ($choisis) { // $my_query = new WP_Query(array( 'post__in' => $choisis)); //var_dump ($my_query); $ids = join("','", $choisis); $sql = "SELECT ID, post_title, post_name FROM {$wpdb->posts}\n\t WHERE ID IN ('{$ids}') AND post_type = 'projet'"; $my_queries = $wpdb->get_results($sql); ?> <div id="content" role="main"> <table style="width: 100%"> <th><h5>Titre</h5></th> <?php //while ($my_query->have_posts()) : //$my_query->the_post(); //var_dump($ids); foreach ($my_queries as $my_query) { ?> <tr> <td> <a href="<?php get_permalink($my_query->ID); ?> " rel="bookmark" title="Permanent Link to <?php get_the_title($my_query->ID); ?> "> <?php if (get_the_title($my_query->ID)) { $title = $my_query->post_title; echo $title; } else { _e('Sans titre'); } ?> </a> </td> <td align="center"> <?php contacter(); ?> </td> </tr> <?php } // end of the loop. ?> </table> </div><!-- #content --> <?php } else { ?> <div>Vous n'avez pas de favoris actuellement</div> <?php } ?> <?php } ?> <a href="javascript:history.back()">Retour</a> </div><!-- #primary --> <?php }