Exemple #1
0
 /**
  * Check if the dashboard widget is allowed.
  *
  * @access private
  * @return bool
  */
 private function dashboard_allowed()
 {
     $tracking = CL_Common::get_option('dashboard_widget', 'general', 'off');
     if ('on' === $tracking) {
         return true;
     }
     return false;
 }
Exemple #2
0
 /**
  * Check if the user has opted into tracking
  *
  * @access private
  * @return bool
  */
 private function tracking_allowed()
 {
     $tracking = CL_Common::get_option('tracking', 'general', false);
     if ('on' === $tracking) {
         return true;
     }
     return false;
 }
 /**
  * Show global notifications if they are allowed.
  *
  */
 function show_notifications()
 {
     $is_cl_screen = CL_Common::is_settings_page();
     $transient_key = CL_Common::get_transient_key('announcement');
     $ignore_key = CUSTOM_LOGIN_OPTION . '_ignore_announcement';
     $old_message = get_option(CUSTOM_LOGIN_OPTION . '_announcement_message');
     $user_meta = get_user_meta(get_current_user_id(), $ignore_key, true);
     $capability = CL_Common::get_option('capability', 'general', 'manage_options');
     /**
     		delete_user_meta( get_current_user_id(), $ignore_key, 1 );
     		delete_transient( $transient_key );
     		update_option( CUSTOM_LOGIN_OPTION . '_announcement_message', '' ); //*/
     // Current user can't manage options
     if (!current_user_can($capability)) {
         return;
     }
     if (!$is_cl_screen) {
         // Let's not show this at all if not on out menu page. @since 3.1
         return;
         // Global notifications
         if ('off' === CL_Common::get_option('admin_notices', 'general', 'off')) {
             return;
         }
         // Make sure 'Frosty_Media_Notifications' isn't activated
         if (class_exists('Frosty_Media_Notifications')) {
             return;
         }
     }
     // https://raw.github.com/thefrosty/custom-login/master/extensions.json
     $message_url = esc_url(add_query_arg(array('edd_action' => 'cl_announcements'), trailingslashit(CUSTOM_LOGIN_API_URL) . 'cl-checkin-api/'));
     $announcement = CL_Common::wp_remote_get($message_url, $transient_key, DAY_IN_SECONDS, 'CustomLogin');
     // Bail if errors
     if (is_wp_error($announcement)) {
         return;
     }
     // Bail if false or empty
     if (!$announcement || empty($announcement)) {
         return;
     }
     if (trim($old_message) !== trim($announcement->message) && !empty($old_message)) {
         delete_user_meta(get_current_user_id(), $ignore_key);
         delete_transient($transient_key);
         update_option(CUSTOM_LOGIN_OPTION . '_announcement_message', $announcement->message);
     }
     $html = '<div class="updated"><p>';
     $html .= !$is_cl_screen ? sprintf('%2$s <span class="alignright">| <a href="%3$s">%1$s</a></span>', __('Dismiss', CUSTOM_LOGIN_DIRNAME), $announcement->message, esc_url(add_query_arg($ignore_key, wp_create_nonce($ignore_key), admin_url('options-general.php?page=custom-login'))), esc_url(admin_url('options-general.php?page=custom-login#custom_login_general'))) : sprintf('%s', $announcement->message);
     $html .= '</p></div>';
     if (!$user_meta && 1 !== $user_meta || $is_cl_screen) {
         echo $html;
     }
 }
 /**
  * Remove the "Lost your password?" text.
  */
 public function remove_lostpassword_text($translated_text, $untranslated_text)
 {
     global $pagenow;
     if ('wp-login.php' == $pagenow) {
         if ('off' !== CL_Common::get_option('lostpassword_text', 'general')) {
             //make the changes to the text
             switch ($untranslated_text) {
                 case 'Lost your password?':
                     $translated_text = '';
                     break;
             }
         }
     }
     return $translated_text;
 }