Plugin Directory

Changeset 1881547


Ignore:
Timestamp:
05/25/2018 04:13:29 PM (8 years ago)
Author:
ej3martin
Message:

Added option to edit user profile text
Added Database Cleanup

Location:
jade-gdpr/trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • jade-gdpr/trunk/jadeGDPR.php

    r1877969 r1881547  
    55    Description: Adds a Data Protection consent checkbox to the users' profile.  On a Dashboard page, an administrator can see which WordPress users have given, wthdrawn or not yet given consent for their details to be kept.
    66    Author: E Martin
    7     Version: 1.1.5
     7    Version: 1.2.0
    88    Tags: gdpr, consent, profile, users
    99    Text Domain: jade-gdpr
     
    3333    }
    3434
     35/**
     36 * Currently plugin version.
     37 * Update this as you release new versions.
     38 */
     39define( 'jadeGDPR_VERSION', '1.2.0' );
     40
     41   
     42    require_once plugin_dir_path( __FILE__ ) . 'admin/jadegdpr-actions.php';
     43
     44
     45register_activation_hook( __FILE__, 'jadeGDPR_activate' );
     46register_deactivation_hook( __FILE__, 'jadeGDPR_deactivate' );
     47register_uninstall_hook(__FILE__, 'jadeGDPR_uninstall');
     48
    3549// Adds last time the user logged in to wordpress functionalily
    3650function jadeGDPR_last_login( $user_login, $user ) {
    37     update_user_meta( $user->ID, 'last_login', time() );
     51    update_user_meta( $user->ID, 'jade_last_login', time() );
    3852}
    3953add_action( 'wp_login', 'jadeGDPR_last_login', 10, 2 );
     
    86100    if ( !current_user_can( 'edit_user', $user_id ) )
    87101            return FALSE;
    88            
    89             $data =  get_user_meta( $user_id, 'data_protection', true );
     102                   
     103        $data =  get_user_meta( $user_id, 'data_protection', true );
    90104           
    91105            if ( $_POST['data_protection'] !== $data ) {
     
    102116
    103117            }
    104            
    105118    }
    106119   
     120
     121function jadeGDPR_validate_dataprotection(&$errors, $update = null, &$user  = null)
     122{
     123    if (!$_POST['data_protection'])
     124    {
     125        $err_title = __( 'ERROR', 'jade-gdpr' );
     126        $err_msg = __( 'You need to choose a Data Protection option.', 'jade-gdpr' );
     127       
     128        $errors->add('data_protection', "<strong>$err_title</strong>: $err_msg");
     129    }
     130}
     131add_action( 'user_profile_update_errors', 'jadeGDPR_validate_dataprotection' );
     132
     133
    107134function jadeGDPR_plugin_menu() {
    108135    add_menu_page(
     
    118145}
    119146add_action( 'admin_menu', 'jadeGDPR_plugin_menu' );
     147function jadeGDPR_options_menu() {
     148    add_options_page( 'GDPR', 'GDPR', 'edit_users', 'jade-gdpr-options', 'jadeGDPR_options_page');
     149}
     150add_action( 'admin_menu', 'jadeGDPR_options_menu' );
     151add_action( 'admin_init', 'jadeGDPR_register_option' );
     152
     153function jadeGDPR_register_option() {
     154    register_setting( 'jade_gdpr_options_group', 'jade_gdpr_consent_text' );
     155}
     156
     157function jadeGDPR_options_page() {
     158?>
     159<div class="wrap">
     160<h1>Jade GDPR Options Page</h1>
     161<form method="post" action="options.php">
     162    <?php
     163        settings_fields( 'jade_gdpr_options_group' );
     164        do_settings_fields( 'jade_gdpr_options_group', '' );
     165    ?>
     166<table class="form-table">
     167
     168<tr>
     169<th scope="row"><label for="jade_gdpr_consent_text">Consent Text</label></th>
     170<td><textarea name="jade_gdpr_consent_text" id="jade_gdpr_consent_text" rows="5" cols="70"><?php echo get_option(' jade_gdpr_consent_text' ); ?></textarea>
     171<p class="description" id="tagline-description">This is the text that explains the consent to the user on their profile.</p></td>
     172</tr>
     173
     174</table>
     175    <p>Enter Consent profile Text Here:</p>
     176   
     177   
     178    <?php
     179    submit_button();
     180    ?>
     181</form>
     182</div>
     183<?php
     184}
     185
    120186
    121187/**
  • jade-gdpr/trunk/readme.txt

    r1877943 r1881547  
    3131
    3232== Change log ==
    33 
     33= V1.2.0 - 25/05/2018
     34    Added option to change text in user profile.
     35    Added Database Cleanup on plugin uninstall.
     36   
    3437= V1.1.5 - 20-05-2018 =
    3538    Added Translation Support.
  • jade-gdpr/trunk/tabs/notyetreceived.php

    r1877941 r1881547  
    1717        $login = get_user_meta( $user->ID, 'last_login', true );
    1818        if ( !empty( $login ) ) {
    19             echo '<li>'. $user->first_name.' '.$user->last_name.' - '.$user->user_login.' (Last Login: '. date("d-m-Y  H:i", $login ) .')</li>';
     19            echo '<li><b>'. $user->first_name.' '.$user->last_name.' - '.$user->user_login.' (Last Login: '. date("d-m-Y  H:i", $login ) .')</b></li>';
    2020        }
    2121        else { ?>
Note: See TracChangeset for help on using the changeset viewer.