Forum Replies Created

Viewing 40 posts - 1 through 40 (of 68 total)
  • Author
  • in reply to: Paid Memberships #184907
     Roader
    Participant
    COPY CODE
    This is somewhat embarrassing, isn’t it? 
    
    Membresías de Grupo
    
    Mantén un log de esta modificación:

    El problema es que, muchas veces WP no convierte p. ej. é en é. Y muestra eso é en pantalla así mismo.

    in reply to: Adding message button in members loop #184526
     Roader
    Participant

    Hello here!

    This code worked, but not anymore.
    Maybe changed something in the Theme or in BuddyPress. I dont know.

    If you put this code in the functions.php the list of members (members page) disappears, only 2 or 3 are displayed.


    @Radu
    , if you can review that to know what the cause is.

    COPY CODE
    // Adding message button in members directory
    
    function filter_message_button_link( $link ) {
    
        $link =  wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r='. bp_core_get_username( bp_get_member_user_id() ) );
    
    return $link;
    
    }
    
    function display_private_message_button() {
    
        if( is_user_logged_in() && bp_get_member_user_id() != bp_loggedin_user_id() ) {
    
            //bp_send_message_button();
            ?>
            <div id="send-private-message" class="generic-button">
    
                <div class="private-message-button generic-button" ><a href="<?php echo filter_message_button_link(); ?>" class="button small secondary radius" rel="add"><i class="icon-envelope"></i></a></div>
            </div>
    
            <?php
            add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
            }
    }
    add_action( 'bp_directory_members_item_last', 'display_private_message_button',9999 );
    in reply to: SweetDate 3.0 #176044
     Roader
    Participant

    Hi @Radu, I hope you had a good weekend.

    Well, hare again 😀

    Pic 1. Bug…

    Pic 2. There is a problem with Style.css (Child).
    Some css does not work from here, other css works from Quick Css (Theme Opt).
    And viceverse. Or, if you put a css in the 1th line, works, but in the 2th, does not.

    And… for SD 3.x Groups Header Cover was removed… Why?

    I can get it with this:

    COPY CODE
    .groups #cover-image-container {background: #f7f7f7;}
    .group-avatar#item-header-avatar .avatar{border:2px solid #fff !important;}
    a.group-button.join-group{border:1px solid #ddd;-moz-border-radius:3px;-webkit-border-radius:3px;-o-border-radius:3px;border-radius:3px;}
    a.group-button.leave-group{border:1px solid #ddd;-moz-border-radius:3px;-webkit-border-radius:3px;-o-border-radius:3px;border-radius:3px;}
    .groups #item-header div#item-actions ul{background: #fff;}
    .groups #item-header-content .highlight{background: #fff;} 
    .groups #item-header div#item-meta {color: #777;}
    #groups-list .search-item p {color: #777; font-style: normal;}

    This version 3.x has more bugs than 2.9.x :-/

    Attachments:
    You must be logged in to view attached files.
    in reply to: Paid Memberships #175831
     Roader
    Participant
    This reply has been set as private.
    in reply to: Adding message button in members loop #175591
     Roader
    Participant

    For my friend @radu

    Here is the code working very well for logged in users. The solution was adding: if( is_user_logged_in() && bp_get_member_user_id() …

    Now you can add this button in the Next SD update. Is very functional.

    But, I need your help only for something.

    If you click e. g. Add Friend button (1st times), automatically changes to Text: Cancel friendship Request, and the style is broken until you refresh the page. The same, if you click Cancel friendship Request, changes to Add Friend (text).

    Solution: Force the css to stay stable. But, I dont know how!

    COPY CODE
    // Adding message button in members directory
    
    function filter_message_button_link( $link ) {
    
        $link =  wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r='. bp_core_get_username( bp_get_member_user_id() ) );
    
    return $link;
    
    }
    
    function display_private_message_button() {
    
        if( is_user_logged_in() && bp_get_member_user_id() != bp_loggedin_user_id() ) {
    
            //bp_send_message_button();
            ?>
            <div id="send-private-message" class="generic-button">
    
                <div class="private-message-button generic-button" ><a href="<?php echo filter_message_button_link(); ?>" class="button small secondary radius" rel="add"><i class="icon-envelope"></i></a></div>
            </div>
    
            <?php
            add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
            }
    }
    add_action( 'bp_directory_members_item_last', 'display_private_message_button',9999 );
    Attachments:
    You must be logged in to view attached files.
    in reply to: SweetDate 3.0 #175228
     Roader
    Participant

    @radu

    @laura

    A partial solution for some problems is: Do Not Import Nothing. Only Install the Theme very Clean. All modifications Manual from Setting.

    But, there are problems like this:

    If you active default search in Members dir. The input does not have Style.

    If you use this function, the Video Button on Home does not work.
    But, in 2.9.11 this func. work very well!

    This function is very, very important, so please check it.

    COPY CODE
    // Remove Query Strings From Static Resources
    if ( ! is_admin() ) {
    function _remove_script_version( $src ){
    $parts = explode( '?', $src );
    return $parts[0];
    }
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    }
    Attachments:
    You must be logged in to view attached files.
    in reply to: SweetDate 3.0 #175133
     Roader
    Participant

    With SD 2.9.11 all okey!

    When you update, the site breaks.
    I am very upset with this update.

    The problem with Home Page / Video Button continues:

    I do not exactly know the cause of the problem.

    For example, if you Disable this >
    Development mode
    If you enable this, CSS and JS resources will not be loaded minified

    > Kleo Video Button does not work.

    If you Import the Modern Style, Video Button does not work.

    If you use this very Important function > the button does not work.

    COPY CODE
    // Remove Query Strings From Static Resources
    if ( ! is_admin() ) {
    function _remove_script_version( $src ){
    $parts = explode( '?ver', $src );
    return $parts[0];
    }
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    }

    Member directory breaks. I reset the Theme to Default but nothing.

    And again!
    White text on light background is not visible.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Updates #167851
     Roader
    Participant

    #167555

    My solution was:

    COPY CODE
    // Force Strong Username
    function strong_username() {
     global $bp;
    
     if ( !empty( $_POST['signup_username'] ) )
       if ( !valid_username( $_POST['signup_username'] ) ){
        $bp->signup->errors['signup_username'] = __( 'Your username is too weak or short. Please, use uppercase, lowercase and numbers.', 'bp-strong-username-password', 'buddypress' );
       }
     }
     add_action( 'bp_signup_validate', 'strong_username');
    
     function valid_username($candidate) {
       $r1='/[A-Z]/';  //Uppercase 
       $r2='/[a-z]/';  //lowercase
       $r3='/[0-9]/';  //numbers
    
       if(preg_match_all($r1,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r2,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r3,$candidate, $o)<1) return FALSE;
       if(strlen($candidate)<8) return FALSE;
    
       return TRUE;
    }
    
    in reply to: Adding message button in members loop #167849
     Roader
    Participant

    For now, this code works ==> but, does not have CSS for SweetDate. If you want, in your Localhost, try it.

    COPY CODE
    function filter_message_button_link( $link ) {
    
    $link =  wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/compose/?r=’ . bp_core_get_username( bp_get_member_user_id() ) );
    
    return $link;
    
    }
    
    function display_private_message_button() {
    
    if( bp_get_member_user_id() != bp_loggedin_user_id() ) {
    
    bp_send_message_button();
    
    add_filter(‘bp_get_send_private_message_link’, ‘filter_message_button_link’, 1, 1 );
    
    }
    
    }
    
    add_action( ‘bp_directory_members_item’, ‘display_private_message_button’ );
    in reply to: Adding message button in members loop #167244
     Roader
    Participant

    Well, the code adds the button, but, without css.
    And the code works very well.
    Solution:

    Adjust this code for Kleo/SweetDate. (Includes:

    COPY CODE
    
    function filter_message_button_link( $link ) {
    
    $link =  wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_get_member_user_id() ) );
    
    return $link;
    
    }
    
    function display_private_message_button() { 
    
    if( bp_get_member_user_id() != bp_loggedin_user_id() ) {
    
    bp_send_message_button();
    
    add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 );
    
    }
    
    }
    
    add_action( 'bp_directory_members_item', 'display_private_message_button' );

    Includes with: `<a href=”<?php bp_member_permalink(); ?>” class=”small button radius secondary”><i
    class=”icon icon-envelope”></i> <?php _e( ” “, ‘kleo_framework’ ); ?></a>`

    in reply to: Adding message button in members loop #167242
     Roader
    Participant

    Hi Radu, the correct code is:

    COPY CODE
    if ( ! function_exists( 'kleo_bp_member_dir_view_button' ) ):
    	/**
    	 * Render view profile button on members directory
    	 */
    	function kleo_bp_member_dir_view_button() {
    		?>
    		<a href="<?php bp_member_permalink(); ?>" class="small button radius secondary"><i
    				class="icon-angle-right"></i> <?php _e( "View profile", 'kleo_framework' ); ?></a>
    		<?php
    	}
    endif;
    add_action( 'bp_directory_members_item_last', 'kleo_bp_member_dir_view_button', 10 );

    But I need help with ==>
    JULY 11, 2017 AT 23:38 #167080

    in reply to: FontAwesome And Other. #166416
     Roader
    Participant

    Hola Laura.

    El problema es el siguiente:

    Cuando usas el código ==> para remover las ?ver= de todos los .js y .css , por alguna extraña razón es afectado: /sweetdate/custom_buddypress/_inc/css/default.css?ver=2.9.11

    Y esto provoca que el Uploader de rtMedia y el botón de Publicar desaparezcan.

    Una solucion seria añadir un exclude ‘ ‘ a este código, y ahi especificar cual string no va a remover en este caso: default.css?ver=2.9.11, pero como yo no se php por eso no he modificado el código.

    COPY CODE
    // Remove Query Strings From Static Resources
    if ( ! is_admin() ) {
    function _remove_script_version( $src ){
    $parts = explode( '?ver', $src );
    return $parts[0];
    }
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    }
    in reply to: FontAwesome And Other. #165120
     Roader
    Participant

    A Solution:

    The problem is that you don’t have this in header.php:

    COPY CODE
    <head>
    
    	<link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/assets/styles/font-awesome.min.css">
    
    </head>

    For your Next Update, add this line and use font-awesome 4.7.0.

    in reply to: Updates #164569
     Roader
    Participant

    Other important function:

    COPY CODE
    // Limit the access only to Admin
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
     if ( is_admin() && !current_user_can( 'administrator' ) && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
     wp_redirect( home_url() );
     exit;
     }
    }

    But, from the Theme Options, you put selection:

    [ ] Enable limit the access only to Admins

    Include others:

    [ ] Editor
    [ ] Author
    [ ] Contributor
    [ ] Shop Manager (for Woocommerce)
    [ ] All

    And that code will be added to functions.php.

    Variants (for replace):

    If you select Editor, the code is:

    `add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !current_user_can( ‘editor’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }`

    If you select Contributor:

    `add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !current_user_can( ‘contributor’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }`

    If you select Author:

    COPY CODE
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
     if ( is_admin() && !current_user_can( 'administrator' ) && !current_user_can( 'author' ) && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
     wp_redirect( home_url() );
     exit;
     }
    }

    If you select Shop Manager:

    `add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !current_user_can( ‘shop_manager’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }`

    If you select Editor and Shop Manager:

    `add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !current_user_can( ‘editor’ ) && !current_user_can( ‘shop_manager’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }`

    If you select All:

    `add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !current_user_can( ‘editor’ ) && !current_user_can( ‘author’ ) && !current_user_can( ‘contributor’ ) && !current_user_can( ‘shop_manager’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }`

    You can create more combinations with editor, etc.

    in reply to: Updates #164533
     Roader
    Participant
    This reply has been set as private.
    in reply to: Updates #164531
     Roader
    Participant

    Code (correction):

    COPY CODE
    // Restrict Private Message to friends.
    function pp_check_message_recipients( $message_info ) {
    
    	//  site admins are not restricted
    	if ( is_super_admin() )
    		return $message_info;
    	
    	$recipients = $message_info->recipients;
    
    	$friend_ids = friends_get_friend_user_ids( bp_displayed_user_id() ); 
    
    	$nf = 0; 
    		
    	foreach ( $recipients as $key => $recipient ) {
    
    		if ( ! in_array( $recipient->user_id, $friend_ids ) ) 
    			$nf++;
    
    	}
    
    	// if any recipients are not friends, remove everyone from the recipient's list
    	if (  $nf > 0 ) 
    		unset( $message_info->recipients );
    
    	return $message_info;
    }
    add_action( 'messages_message_before_save', 'pp_check_message_recipients' );
    in reply to: FontAwesome And Other. #164528
     Roader
    Participant

    Hi Radu. For now… icons are working.

    I Uninstalled and Re-installed all… Maybe the problem is the Import xml. In this chance, I don’t used the Demo xml.

    Assets/ Font… I updated the Fonts to 4.7.0 and I putted this in functions.php:

    COPY CODE
    function using_font_awesome(){
    	wp_enqueue_style('font-awesome', get_template_directory_uri() . '/styles/font-awesome.min.css');  
    }
    add_action('wp_enqueue_style','using_font_awesome');

    ______________

    – The other problem is with rtMedia, is outdate and does not work with SD and WP 4.8.

    – ShortCodes Window: Blank… not display.

    – My friend Radu, remember this please Topic

    in reply to: SweeDate: Security Tips #163901
     Roader
    Participant

    NOTES:

    // Limit access to DashBoard only to Admin

    But, if you wants access for an editor use:

    COPY CODE
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
    if ( is_admin() && ! current_user_can( 'administrator') && ! current_user_can( 'editor')&&
    ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }

    For Admin, Editor and Shop Manager:

    COPY CODE
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
    if ( is_admin() && ! current_user_can( 'administrator') && ! current_user_can( 'editor') && ! current_user_can( 'shop_manager')&&
    ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }

    // Change your username by a nickname

    After you add this code to your functions.php, go to: Dashboard / Users and, Update all users. For example: If your username is lover360, and your name-last-name is: John Wick, so, your nickname needs to be: johnwick, and your Public name to display: John Wick. Remember, lover360 is your Login, and this needs to be secret.

    For new members this code works automatic.

    in reply to: SweeDate: Security Tips #163899
     Roader
    Participant

    OPTIMIZATIONS
    UPDATES

    Working fine on HostGator (APACHE).
    ————————–

    .HTACCESS. BASIC SECURITY AND SPEED
    Note: In the line: RewriteRule .* http://example.com/? [L,R=302], change example.com with your own Url.

    COPY CODE
    # SECURITY START
    
    # Protect htaccess
    <files .htaccess>
    order allow,deny
    deny from all
    </files>
    
    # Protect wpconfig.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # Protect wp-includes
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    </IfModule>
    
    # Protect Headers
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options nosniff
    Header always append X-Frame-Options SAMEORIGIN
    Header set X-Content-Security-Policy "allow 'self';"
    Header always unset "X-Powered-By"
    Header always edit Set-Cookie "(?i)^((?:(?!;\s?HttpOnly).)+)$" "$1; HttpOnly"
    
    # Block WP File Access 
    <FilesMatch "^(install\.php|php\.ini|readme\.html|license\.txt)">
    Order Allow,Deny
    Deny from all
    </FilesMatch>
    
    # Block xmlrpc.php if you don’t use that.
    <files xmlrpc.php>
    order allow,deny
    deny from all
    </files>
    
    # Block debug.log 
    <files debug.log>
    order allow,deny
    deny from all
    </files>
    
    # Disable Index Views
    Options -Indexes
    
    # Disable Trace_Track
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
    </IfModule>
    
    # Block User ID Phishing Requests
    <IfModule mod_rewrite.c>
    	RewriteCond %{QUERY_STRING} ^author=([0-9]*)
    	RewriteRule .* http://example.com/? [L,R=302]
    </IfModule>
    
    # Forbid Proxy Comments
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^POST
    RewriteCond %{HTTP:VIA} !^$ [OR]
    RewriteCond %{HTTP:FORWARDED} !^$ [OR]
    RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
    RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
    RewriteCond %{HTTP:X_FORWARDED_HOST} !^$ [OR]
    RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
    RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
    RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
    RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
    RewriteRule wp-comments-post\.php - [F]
    </IfModule>
    
    # Deny Bad Query Strings
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ftp:     [NC,OR]
    RewriteCond %{QUERY_STRING} http:    [NC,OR]
    RewriteCond %{QUERY_STRING} https:   [NC,OR]
    RewriteCond %{QUERY_STRING} mosConfig [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
    RewriteCond %{QUERY_STRING} (\;|'|\"|%22).*(request|insert|union|declare|drop) [NC]
    RewriteRule ^(.*)$ - [F,L]
    </IfModule>
    
    ErrorDocument 403 /403.shtml
    ErrorDocument 404 /404.shtml
    ErrorDocument 500 /500.shtml
    
    ServerSignature Off
    LimitRequestBody 10240000
    
    # SECURITY END
    
    # SPEED START
    
    # Habilitar compresion Gzip
    <ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </ifModule>
    
    # BEGIN WEBSITE SPEED BOOST
    # Time cheat sheet in seconds
    # A86400 = 1 day
    # A172800 = 2 days
    # A2419200 = 1 month
    # A4838400 = 2 months
    # A29030400 = 1 year
    
    # Test which ETag setting works best on your Host/Server/Website
    # with Firefox Firebug, Firephp and Yslow benchmark tests.
    
    # Create the ETag (entity tag) response header field
    # This is probably not the optimum choice to use.
    #FileETag MTime Size
    
    # Remove the ETag (entity tag) response header field
    # This is most likely the optimum choice to use.
    Header unset ETag
    FileETag None
    
    <IfModule mod_mime.c>
        AddType application/javascript                      js
        AddType audio/mp4                                   f4a f4b m4a
        AddType audio/ogg                                   oga ogg opus
        AddType image/bmp                                   bmp
        AddType image/svg+xml                               svg svgz
        AddType image/webp                                  webp
        AddType video/mp4                                   f4v f4p m4v mp4
        AddType video/ogg                                   ogv
        AddType video/webm                                  webm
        AddType video/x-flv                                 flv
        AddType image/x-icon                                cur ico
        AddType application/font-woff                       woff
        AddType application/font-woff2                      woff2
        AddType application/vnd.ms-fontobject               eot
        AddType application/x-font-ttf                      ttc ttf
        AddType font/opentype                               otf
    </IfModule>
    
    <IfModule mod_expires.c>
    ExpiresActive on
    # ExpiresByType overrides the ExpiresDefault...
    # cache expiration time of 2 days|A172800.
    ExpiresDefault A172800
    ExpiresByType text/css A2419200
    ExpiresByType text/html A2419200
    ExpiresByType text/javascript A2419200
    ExpiresByType text/x-javascript A2419200
    ExpiresByType application/x-javascript A2419200
    ExpiresByType application/javascript A2419200
    ExpiresByType application/x-font-ttf A2419200
    ExpiresByType application/x-font-woff A2419200
    ExpiresByType font/opentype A4838400
    ExpiresByType application/x-shockwave-flash A2419200
    ExpiresByType image/vnd.microsoft.icon A2419200
    ExpiresByType image/jpg A2419200
    ExpiresByType image/jpeg A2419200
    ExpiresByType image/gif A2419200
    ExpiresByType image/png A2419200
    ExpiresByType image/bmp A2419200
    ExpiresByType image/webp A2419200
    ExpiresByType image/x-icon A2419200
    ExpiresByType image/svg+xml A2419200
    ExpiresByType video/mp4 A2419200
    ExpiresByType video/ogg A2419200
    ExpiresByType video/webm A2419200
    ExpiresByType audio/ogg A2419200
    ExpiresByType font/eot  A2419200
    ExpiresByType font/opentype A2419200
    ExpiresByType font/woff  A2419200
    ExpiresByType application/font-woff2 A2419200
    ExpiresByType application/x-font-woff A2419200
    ExpiresByType application/x-font-ttf A2419200
    ExpiresByType application/vnd.ms-fontobject A2419200
    </IfModule>
    
    <IfModule mod_headers.c>
    <FilesMatch "\.(js|css|flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|gif|jpg|jpeg|png|swf|webm)$">
    Header append Cache-Control "public"
    </FilesMatch>
    <FilesMatch "\.(txt|html)$">
    Header append Cache-Control "proxy-revalidate"
    </FilesMatch>
    <FilesMatch "\.(php|cgi|pl|htm|xml)$">
    Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    Header set Pragma "no-cache"
    </FilesMatch>
    </IfModule>
    
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript
    AddOutputFilterByType DEFLATE application/javascript application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
    AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/xml-dtd
    AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
    AddOutputFilterByType DEFLATE font/eot font/otf font/opentype application/font-otf application/x-font-otf
    AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
    AddOutputFilterByType DEFLATE image/bmp image/svg+xml image/x-icon image/vnd.microsoft.icon
    
    # Drop problematic browsers
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    
    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
    </IfModule>
    
    #SPEED END

    —————————

    INSIDE WP-CONTENT FOLDER
    Create a new file named .htaccess and put this:

    COPY CODE
    # Protect htaccess
    <Files .htaccess>
    Order allow,deny
    Deny from all
    </files>
    
    <FilesMatch "\.(?i:php)$">
      <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
      </IfModule>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
    </FilesMatch>
    
    Order deny,allow
    Deny from all
    <Files ~ ".(xml|css|jpe?g|png|gif|js|mp3|mp4)$">
    Allow from all
    </Files>

    ———————-
    IN YOUR CHILD THEME FUNCTIONS.PHP

    // Enable Automatic Updates for WordPress Plugins
    add_filter( ‘auto_update_plugin’, ‘__return_true’ );

    // Limit access to DashBoard only to Admin
    add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && !current_user_can( ‘administrator’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( home_url() );
    exit;
    }
    }

    // Change your username by a nickname
    function set_default_display_name( $user_id ) {
    $user = get_userdata( $user_id );
    $name = sprintf( ‘%s %s’, $user->first_name, $user->last_name );
    $nickname = sanitize_user( strtolower( str_replace( ‘ ‘, ”, $name ) ) );
    $args = array(
    ‘ID’ => $user_id,
    ‘display_name’ => $name,
    ‘nickname’ => $nickname,
    ‘user_nicename’ => $nickname
    );
    wp_update_user( $args );
    }
    add_action( ‘user_register’, ‘set_default_display_name’ );

    // Force strong password
    function strong_password() {
    global $bp;

    if ( !empty( $_POST[‘signup_password’] ) )
    if ( !valid_pass( $_POST[‘signup_password’] ) ){
    $bp->signup->errors[‘signup_password’] = __( ‘Your password is not strong enough. Please, write a strong password using characters: A-Z, a-z, 0-9, @#$%&*-:;,.!’, ‘buddypress’ );
    }
    }
    add_action( ‘bp_signup_validate’, ‘strong_password’);

    function valid_pass($candidate) {
    $r1=’/[A-Z]/’; //Uppercase
    $r2=’/[a-z]/’; //lowercase
    $r3=’/[!@#$%^&*()-_=+{};:,<.>]/’; // whatever you mean by special char
    $r4=’/[0-9]/’; //numbers

    if(preg_match_all($r1,$candidate, $o)<1) return FALSE;
    if(preg_match_all($r2,$candidate, $o)<1) return FALSE;
    if(preg_match_all($r3,$candidate, $o)<1) return FALSE;
    if(preg_match_all($r4,$candidate, $o)<1) return FALSE;
    if(strlen($candidate)<8) return FALSE;

    return TRUE;
    }

    // Restricted Email Domains
    add_option(‘limited_email_domains’, array(‘yahoo.com’, ‘outlook.com’, ‘hotmail.com’, ‘gmail.com’, ‘aol.com’, ‘mail.com’));

    // Decrease image compression in WordPress
    add_filter( ‘wp_generate_attachment_metadata’, function( $metadata, $attachment_id )
    {
    $file = get_attached_file( $attachment_id );
    $type = get_post_mime_type( $attachment_id );

    // Target jpeg images
    if( in_array( $type, [ ‘image/jpg’, ‘image/jpeg’ ] ) )
    {
    // Check for a valid image editor
    $editor = wp_get_image_editor( $file );
    if( ! is_wp_error( $editor ) )
    {
    // Set the new image quality
    $result = $editor->set_quality( 75 );

    // Re-save the original image file
    if( ! is_wp_error( $result ) )
    $editor->save( $file );
    }
    }
    return $metadata;
    }, 10, 2 );

    // Defer jQuery Parsing using the HTML5 defer property
    if (!(is_admin() )) {
    function defer_parsing_of_js ( $url ) {
    if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
    if ( strpos( $url, ‘jquery.js’ ) ) return $url;
    // return “$url’ defer “;
    return “$url’ defer onload='”;
    }
    add_filter( ‘clean_url’, ‘defer_parsing_of_js’, 11, 1 );
    }

    // Remove WP Header Junk
    // all actions related to emojis
    remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 );
    remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ );

    // Remove the REST API endpoint.
    remove_action( ‘wp_head’, ‘rest_output_link_wp_head’);
    remove_action( ‘wp_head’, ‘wp_oembed_add_discovery_links’ );
    remove_action( ‘wp_head’, ‘wp_oembed_add_host_js’ );

    remove_action(‘wp_head’, ‘rsd_link’); // remove really simple discovery link
    remove_action(‘wp_head’, ‘wp_generator’); // remove wordpress version

    remove_action(‘wp_head’, ‘feed_links’, 2); // remove rss feed links (make sure you add them in yourself if youre using feedblitz or an rss service)
    remove_action(‘wp_head’, ‘feed_links_extra’, 3); // removes all extra rss feed links

    remove_action(‘wp_head’, ‘index_rel_link’); // remove link to index page
    remove_action(‘wp_head’, ‘wlwmanifest_link’); // remove wlwmanifest.xml (needed to support windows live writer)

    remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0); // remove random post link
    remove_action(‘wp_head’, ‘parent_post_rel_link’, 10, 0); // remove parent post link
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0); // remove the next and previous post links
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 ); // remove the next and previous post links

    remove_action(‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0 );

    wp_deregister_script( ‘comment-reply’ ); // Remove comment-reply.min.js from footer

    // Protect commentary box
    add_filter(‘pre_comment_content’, ‘wp_specialchars’);

    // Enable shortcodes in text widgets
    add_filter(‘widget_text’,’do_shortcode’);

    // BP redirect to profile
    function redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ) {
    if ( ! $user || is_wp_error( $user ) ) {
    return $redirect_to_calculated;
    }
    //If the redirect is not specified, assume it to be dashboard
    if ( empty( $redirect_to_calculated ) ) {
    $redirect_to_calculated = admin_url();
    }
    // if the user is not site admin, redirect to his/her profile
    if ( ! is_super_admin( $user->ID ) ) {
    return bp_core_get_user_domain( $user->ID );
    } else {
    //if site admin or not logged in, do not do anything much
    return $redirect_to_calculated;
    }
    }
    add_filter( ‘login_redirect’, ‘redirect_to_profile’, 100, 3 );

    // Exclude admins from directories and BP widgets
    add_filter( ‘bp_after_has_members_parse_args’, ‘buddydev_exclude_users’ );

    function buddydev_exclude_users( $args ) {
    //do not exclude in admin
    if( is_admin() && ! defined( ‘DOING_AJAX’ ) ) {
    return $args;
    }

    $excluded = isset( $args[‘exclude’] )? $args[‘exclude’] : array();

    if( !is_array( $excluded ) ) {
    $excluded = explode(‘,’, $excluded );
    }

    $user_ids = array( 1 ); //user ids

    $excluded = array_merge( $excluded, $user_ids );

    $args[‘exclude’] = $excluded;

    return $args;
    }

    // Make xprofile fields translable fix
    if (!function_exists(‘make_x_profile_fields_name_translable’)):

    function make_x_profile_fields_name_translable($fieldname) {
    return __($fieldname, ‘kleo_framework’);
    }

    add_filter(‘bp_get_the_profile_field_name’, ‘make_x_profile_fields_name_translable’);

    endif;

    // Remove Query Strings From Static Resources
    if ( ! is_admin() ) {
    function _remove_script_version( $src ){
    $parts = explode( ‘?ver’, $src );
    return $parts[0];
    }
    add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );
    add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );
    }

    // MINIFY YOUR HTML, JAVASCRIPT AND CSS
    if ( ! is_admin() ) {
    class WP_HTML_Compression
    {
    // Settings
    protected $compress_css = true;
    protected $compress_js = false;
    protected $info_comment = true;
    protected $remove_comments = true;

    // Variables
    protected $html;

    public function __construct($html)
    {
    if (!empty($html))
    {
    $this->parseHTML($html);
    }
    }

    public function __toString()
    {
    return $this->html;
    }

    protected function minifyHTML($html)
    {
    $pattern = ‘/<(?<script>script).*?<\/script\s*>|<(?<style>style).*?<\/style\s*>|<!(?<comment>–).*?–>|<(?<tag>[\/\w.:-]*)(?:”.*?”|\’.*?\’|[^\'”>]+)*>|(?<text>((<[^!\/\w.:-])?[^<]*)+)|/si’;
    preg_match_all($pattern, $html, $matches, PREG_SET_ORDER);
    $overriding = false;
    $raw_tag = false;
    // Variable reused for output
    $html = ”;
    foreach ( $matches as $token ) {

    $tag = (isset($token[‘tag’])) ? strtolower($token[‘tag’]) : null;
    $content = $token[0];

    if ( is_null( $tag ) ) {

    if ( !empty( $token[‘script’] ) ) {

    $strip = $this->compress_js;

    } else if ( !empty($token[‘style’] ) ) {

    $strip = $this->compress_css;

    } else if ( $content == ‘<!–wp-html-compression no compression–>’ ) {

    $overriding = !$overriding;
    // Don’t print the comment
    continue;

    } else if ( $this->remove_comments ) {

    if ( !$overriding && $raw_tag != ‘textarea’ ) {

    // Remove any HTML comments, except MSIE conditional comments
    $content = preg_replace(‘/<!–(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!–>).)*–>/s’, ”, $content);
    }
    }

    } else {

    if ( $tag == ‘pre’ || $tag == ‘textarea’ || $tag == ‘script’ ) {

    $raw_tag = $tag;

    } else if ( $tag == ‘/pre’ || $tag == ‘/textarea’ || $tag == ‘/script’ ) {

    $raw_tag = false;

    } else {

    if ($raw_tag || $overriding) {

    $strip = false;

    } else {

    $strip = true;

    // Remove any empty attributes, except:
    // action, alt, content, src
    $content = preg_replace(‘/(\s+)(\w++(?<!\baction|\balt|\bcontent|\bsrc)=””)/’, ‘$1’, $content);

    // Remove any space before the end of self-closing XHTML tags
    // JavaScript excluded
    $content = str_replace(‘ />’, ‘/>’, $content);
    }

    }

    }

    if ( $strip ) {

    $content = $this->removeWhiteSpace($content);
    }

    $html .= $content;
    }

    return $html;
    }

    public function parseHTML($html)
    {
    $this->html = $this->minifyHTML($html);
    }

    protected function removeWhiteSpace($str)
    {
    $str = str_replace( “\t”, ‘ ‘, $str );
    $str = str_replace( “\n”, ”, $str );
    $str = str_replace( “\r”, ”, $str );

    while ( stristr($str, ‘ ‘ ) ) {

    $str = str_replace(‘ ‘, ‘ ‘, $str);
    }

    return $str;
    }
    }

    function wp_html_compression_finish($html) {

    return new WP_HTML_Compression($html);
    }

    function wp_html_compression_start() {

    ob_start( ‘wp_html_compression_finish’ );
    }

    // add_action( ‘get_header’, ‘wp_html_compression_start’ );
    add_action( ‘wp_loaded’, ‘wp_html_compression_start’ ); // for working with SEO by Yoast
    }

    in reply to: Problem with HomePage #163259
     Roader
    Participant

    Hi Radu.

    Solution for the Fonts: In Theme Options: Select: Arial, Arial…

    Um I removed this code ===> from my style.css but the problem continues. And yes, in Default Theme this problem does not exists. So, Let me check…

    COPY CODE
    .buddypress div.message-search #messages_search {
        margin-right: -90px;
        margin-left: 20px;
        display: inline-block;
        position: relative;
        right: 150px;
        top: 44px;
    }
    in reply to: Problem with Favorite using Remove jquery strings #158009
     Roader
    Participant

    File Attachments with Contact Form 7: Solution:

    First check your CF code, for me for example:

    COPY CODE
    <label> Your Name (required)
        [text* your-name] </label>
    
    <label> Your Email (required)
        [email* your-email] </label>
    
    <label> Subject
        [text your-subject] </label>
    
    <label> Your Message
        [textarea your-message] </label>
    
    [file file-100 limit:1048576 filetypes:jpg|jpeg]
    
    [submit "Send"]

    (Recommendation: Use Google reCaptcha with CF7)

    Now, go to Mail tab, and add (for example) [file-100] in File Attachments text area and Save.

    After that:
    Go to /uploads/wpcf7_uploads (in your Hosting: public_html)
    Open the .htaccess file and put (and Save):

    order deny,allow
    deny from all
    allow from 127.0.0.1

    Mail go to Spam folder: Solution: Use MailBank Plugin.

    in reply to: Problem with HomePage #156640
     Roader
    Participant

    Gracias Laura. La solución completa es:

    Crear el profile field, I am a: Shemale.

    Poner este código en la Home Page:

    [kleo_status_icon type="custom" field="I am a" value="Shemale" online="no" subtitle="Shemale in total" image="http://yoursite.com/wp-content/themes/sweetdate-child/images/status_05.png"]

    Y usar este css:

    COPY CODE
    div.status.three.columns.mobile-one {width: 20%; !important}
    @media only screen and (max-width: 767px) { div.status.three.columns.mobile-one { width: 20% !important; float: left; padding: 0 16px; } }
    Attachments:
    You must be logged in to view attached files.
    in reply to: Problem with Favorite using Remove jquery strings #156639
     Roader
    Participant

    Hi Radu. Does not work.

    COPY CODE
    // Remove query string from static files
    if( ! is_buddypress() ) {
    add_filter( 'style_loader_src', 'sdt_remove_ver_css_js', 9999 );
    // Remove WP Version From Scripts
    add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999 );
    }
    // Function to remove version numbers
    function sdt_remove_ver_css_js( $src ) {
    	if ( strpos( $src, 'ver=' ) )
    		$src = remove_query_arg( 'ver', $src );
    	return $src;
    }

    _____________
    Or:

    COPY CODE
    if( ! is_buddypress() ) {
    function _remove_script_version( $src ){
    $parts = explode( '?ver', $src );
    return $parts[0];
    }
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    }

    And, I need to use this part too:

    if ( ! is_admin() ) { }

    in reply to: Bugs and Issues with CSS #152427
     Roader
    Participant

    How can I remove theses external links? And, remember to Update Fontawesome, now is 4.7.0, sweetdate are using the old version. And, How can I use this fonts in stylesheet (child)?

    I used ==> But this is repetitive. Because the fonts are in sweetdate/ assets. But now, this fonts are not working.

    COPY CODE
    
    //  Enqueues our locally supplied font awesome stylesheet
    function enqueue_our_required_stylesheets(){
    	wp_enqueue_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.css'); 
    	}
    add_action('wp_enqueue_scripts','enqueue_our_required_stylesheets');
    Attachments:
    You must be logged in to view attached files.
    in reply to: How can I hide, or remove author from… #152267
     Roader
    Participant

    Other Measure:

    COPY CODE
    // BuddyPress Honeypot. Stop Spammers Registration. 
    function add_honeypot() {
        echo '';
    }
    add_action('bp_after_signup_profile_fields','add_honeypot');
    function check_honeypot() {
        if (!empty($_POST['system55'])) {
            global $bp;
            wp_redirect(home_url());
            exit;
        }
    }
    add_filter('bp_core_validate_user_signup','check_honeypot');
    in reply to: How can I hide, or remove author from… #152159
     Roader
    Participant

    My friend Radu, the Solution for this Topic is:

    COPY CODE
    function set_default_display_name( $user_id ) {
    $user = get_userdata( $user_id );
    $name = sprintf( '%s %s', $user->first_name, $user->last_name );
    $nickname = sanitize_user( strtolower( str_replace( ' ', '', $name ) ) );
    $args = array(
    'ID' => $user_id,
    'display_name' => $name,
    'nickname' => $nickname,
    'user_nicename' => $nickname
    );
    wp_update_user( $args );
    }
    add_action( 'user_register', 'set_default_display_name' );
    in reply to: SweetDate – Security: Weak Points #152043
     Roader
    Participant
    COPY CODE
    // Force strong password BuddyPress plugin
    
    function lehelmatyus_validation() {
     global $bp;
    
     if ( !empty( $_POST['signup_password'] ) )
       if ( !valid_pass( $_POST['signup_password'] ) ){
        $bp->signup->errors['signup_password'] = __( 'Your password is not strong enough. It needs to be at least 8 characters long, and must contain at least: 1 lowercase character (a-z), 1 uppercase character (A-Z), 1 number (0-9) and 1 special character (!@#..)', 'buddypress' );
       }
     }
     add_action( 'bp_signup_validate', 'lehelmatyus_validation');
    
     function valid_pass($candidate) {
       $r1='/[A-Z]/';  //Uppercase
       $r2='/[a-z]/';  //lowercase
       $r3='/[!@#$%^&*()-_=+{};:,<.>]/';  // whatever you mean by special char
       $r4='/[0-9]/';  //numbers
    
       if(preg_match_all($r1,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r2,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r3,$candidate, $o)<1) return FALSE;
       if(preg_match_all($r4,$candidate, $o)<1) return FALSE;
       if(strlen($candidate)<8) return FALSE;
    
       return TRUE;
    }
    Attachments:
    You must be logged in to view attached files.
    in reply to: SweetDate – Security: Weak Points #152037
     Roader
    Participant

    Limit buddypress (sweetdate) user email domains:

    SOLUTION:

    Create a basic plugin: restricted-email-domains.php

    COPY CODE
    <?php
    /*
    Plugin Name: Restricted Email Domains
    Description: Restricts registration user email addresses to @valid-domains.com
    From: http://old.webit.ca/2011/03/limit-user-email-domains-in-buddypress/
    Version: 1.0
    */
    add_option('limited_email_domains', array('yahoo.com', 'outlook.com', 'hotmail.com', 'gmail.com', 'aol.com', 'mail.com')); 

    Then, Radu, help me with Force users to use Strong Passwd in BP.

    in reply to: SweetDate – Security: Weak Points #151999
     Roader
    Participant

    UPDATE CODE:

    COPY CODE
    function set_default_display_name( $user_id ) {
    $user = get_userdata( $user_id );
    $name = sprintf( '%s %s', $user->first_name, $user->last_name );
    $nickname = sanitize_user( strtolower( str_replace( ' ', '', $name ) ) );
    $args = array(
    'ID' => $user_id,
    'display_name' => $name,
    'nickname' => $nickname,
    'user_nicename' => $nickname
    );
    wp_update_user( $args );
    }
    add_action( 'user_register', 'set_default_display_name' );
    in reply to: SweetDate – Security: Weak Points #151998
     Roader
    Participant

    RADU. The Solution for changing username / nickname is:

    But please, check the Register Form, I dont know why! The code for valid Emails does not work. And not work Force Strong Passwd.

    COPY CODE
    function set_default_display_name( $user_id ) {
    $user = get_userdata( $user_id );
    $name = sprintf( '%s %s', $user->first_name, $user->last_name );
    $nickname = strtolower( str_replace( ' ', '', $name ) );
    $args = array(
    'ID' => $user_id,
    'display_name' => $name,
    'nickname' => $nickname,
    'user_nicename' => $nickname
    );
    wp_update_user( $args );
    }
    add_action( 'user_register', 'set_default_display_name' );
    in reply to: SweetDate – Security: Weak Points #151997
     Roader
    Participant

    RADU, for example:
    But, does not work, I dont know why! :-/

    COPY CODE
    function set_default_display_name( $user_id ) {
      $user = get_userdata( $user_id );
      $name = sprintf( '%s %s', $user->first_name, $user->last_name );
      $args = array(
        'ID' => $user_id,
        'display_name' => $name,
        'nickname' => $name
      );
      wp_update_user( $args );
    }
    add_action( 'user_register', 'set_default_display_name' );

    Source: quick-tip-set-the-default-display-name-for-wordpress-users

    in reply to: SweetDate – Security: Weak Points #151646
     Roader
    Participant

    For My friend Radu.
    I know he dislikes my requests, but I do them for the benefit of all.

    WordFence. Please, check this problem, or… includes. STRONG (LINK)

    FUNCTIONS:

    Point 3: Well, this works, but Only with Author Blog / Post, not with Comments, etc.
    This code automatically change UserName for NickName. For BuddyPress @Username in Profile, check this Code (Link). It would help us a simple function based on this.

    COPY CODE
    add_filter( 'request', 'wpse5742_request' );
    function wpse5742_request( $query_vars )
    {
        if ( array_key_exists( 'author_name', $query_vars ) ) {
            global $wpdb;
            $author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='nickname' AND meta_value = %s", $query_vars['author_name'] ) );
            if ( $author_id ) {
                $query_vars['author'] = $author_id;
                unset( $query_vars['author_name'] );    
            }
        }
        return $query_vars;
    }
    
    add_filter( 'author_link', 'wpse5742_author_link', 10, 3 );
    function wpse5742_author_link( $link, $author_id, $author_nicename )
    {
        $author_nickname = get_user_meta( $author_id, 'nickname', true );
        if ( $author_nickname ) {
            $link = str_replace( $author_nicename, $author_nickname, $link );
        }
        return $link;
    }

    Point 4:

    I found this, but, does not work. Please, check it.

    CODE 1.

    COPY CODE
    // Restrict WordPress Registration to Email Whitelist
    add_action('registration_errors', 'sizeable_restrict_domains', 10, 3);
    function sizeable_restrict_domains( $errors, $login, $email ) {
    	$whitelist = array("yahoo.com","hotmail.com");
    	if ( is_email($email) ) {
    		$parts = explode('@', $email);
    		$domain = $parts[count($parts)-1];
    		if ( !in_array(strtolower($domain), $whitelist) ) {
    			$errors->add('email_domain', __('ERROR: You may only register with an approved email address.'));
    		}
    	}
    	return $errors;
    }

    CODE 2.

    COPY CODE
    // Restrict WordPress Registration to Email Whitelist
    function is_valid_email_domain($login, $email, $errors ){
     $valid_email_domains = array("yahoo.com","hotmail.com","outlook.com","gmail.com","aol.com","mail.com");;// whitelist email domain lists
     $valid = false;
     foreach( $valid_email_domains as $d ){
     $d_length = strlen( $d );
     $current_email_domain = strtolower( substr( $email, -($d_length), $d_length));
     if( $current_email_domain == strtolower($d) ){
     $valid = true;
     break;
     }
     }
     // if invalid, return error message
     if( $valid === false ){
     $errors->add('domain_whitelist_error',__( '<strong>ERROR</strong>: you can only register using @gmail.com or @outlook.com emails' ));
     }
    }
    add_action('register_post', 'is_valid_email_domain',10,3 );
    in reply to: How can I hide, or remove author from… #151436
     Roader
    Participant

    Other code, but not work from functions.php, maybe needs other lines.

    COPY CODE
    if ( $comment->user_id != '0' ) {
        echo '<span class="some-class">' . get_user_meta( $comment->user_id, 'nickname', true ) . '</span>';
    } else {
        echo '<span class="other-class">' . get_comment_author_link() . '</span>';
    }
    in reply to: How can I hide, or remove author from… #151423
     Roader
    Participant

    My friend Radu 😀

    This code work, but, only with Author (from Blog / Posts). In this example, you can see: author = user demo (nickname) instead sweetadmin (by default).

    This code does not work with: Comments, etc., BuddyPress and BbPress. So, PLEASE… Help with the others!

    Force with this, to show nickname only in Profile, /members/ , forums/profile, / comment-meta, etc.

    COPY CODE
    add_filter( 'request', 'wpse5742_request' );
    function wpse5742_request( $query_vars )
    {
        if ( array_key_exists( 'author_name', $query_vars ) ) {
            global $wpdb;
            $author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='nickname' AND meta_value = %s", $query_vars['author_name'] ) );
            if ( $author_id ) {
                $query_vars['author'] = $author_id;
                unset( $query_vars['author_name'] );    
            }
        }
        return $query_vars;
    }
    
    add_filter( 'author_link', 'wpse5742_author_link', 10, 3 );
    function wpse5742_author_link( $link, $author_id, $author_nicename )
    {
        $author_nickname = get_user_meta( $author_id, 'nickname', true );
        if ( $author_nickname ) {
            $link = str_replace( $author_nicename, $author_nickname, $link );
        }
        return $link;
    }
    Attachments:
    You must be logged in to view attached files.
    in reply to: How can I hide, or remove author from… #151398
     Roader
    Participant

    Maybe… I dont know… you are the master in php… If you get something… let me know.

    COPY CODE
    if ( $comment->user_id != '0' ) {
        echo '<span class="some-class">' . get_user_meta( $comment->user_id, 'nickname', true ) . '</span>';
    } else {
        echo '<span class="other-class">' . get_comment_author_link() . '</span>';
    }

    Comment, Post, Activity, Profile…

    in reply to: Wp Admin Restricted #151293
     Roader
    Participant

    Other solution is:

    An .htaccess in wp-admin folder:

    COPY CODE
    # Protect wp-admin by my IP
    order deny,allow
    allow from 0000000000 #Change it for your IP
    deny from all
     
    <Files admin-ajax.php>
      Order Allow,Deny
      Allow from All
      Satisfy Any
    </Files>

    ————————

    But, there are some problems…
    Radu. I found this code ===> But, does not work. :-/
    I dont know if is Sweetdate Registration Form or BuddyPress… The problem is, that you can Register with whatever Email, i.e. mydog@mydogisbig.com

    And, there is not a button of field to Resend the Email Confirmation, after you complete.

    COPY CODE
    // Restrict WordPress Registration to Email Whitelist
    function is_valid_email_domain($login, $email, $errors ){
     $valid_email_domains = array("yahoo.com","hotmail.com","outlook.com","gmail.com","aol.com","mail.com");;// whitelist email domain lists
     $valid = false;
     foreach( $valid_email_domains as $d ){
     $d_length = strlen( $d );
     $current_email_domain = strtolower( substr( $email, -($d_length), $d_length));
     if( $current_email_domain == strtolower($d) ){
     $valid = true;
     break;
     }
     }
     // if invalid, return error message
     if( $valid === false ){
     $errors->add('domain_whitelist_error',__( '<strong>ERROR</strong>: you can only register using @gmail.com or @outlook.com emails' ));
     }
    }
    add_action('register_post', 'is_valid_email_domain',10,3 );
    in reply to: Wp Admin Restricted #151292
     Roader
    Participant

    Laura, a partial solution is:

    In functions.php:

    COPY CODE
    // Restrict WP Dashboard 
    add_action( 'init', 'blockusers_init' );
    function blockusers_init() {
     if ( is_admin() && !current_user_can( 'administrator' ) && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
     wp_redirect( home_url() );
     exit;
     }
    }

    In .htaccess (fist line only)
    // Change wp-login to your custom url
    RewriteRule ^your-custom-login-name$ http://your-domain.com/wp-login.php [NC,L,R]

    in reply to: How I can see… #151287
     Roader
    Participant

    I almost forget it.
    8) Support to translate Buddypress Custom Fields (again Radu, qTranslate works, but it is outdated, so WpGlobus or similar).

    Returning to the Topic of: How can I see …

    The code you gave me does not work well.

    COPY CODE
    
    form.custom.form-search .seven, .row .seven {width:75%;}
    form.custom.form-search .five.mobile-four.columns {width:25%}

    The idea is to align the text ==> to the left:

    Username
    Email
    Password

    Also: I am, Looking for, City…

    And expand some more the fields:

    (Passwsd) [ Required ] and [ Confirm ]

    Attachments:
    You must be logged in to view attached files.
    in reply to: How can I hide, or remove author from… #151262
     Roader
    Participant

    Good Morning or Night my friend Radu.

    You, as a developer, must provide three features: Security, Speed​​* and Easy Optimization.

    Here, let’s talk about Security.

    Many buy Themes 7THQ, but they are newbies, they do not know anything about Security.

    You should put a Warning in the Theme, which says:

    You can secure your site by installing any of these plugins:

    – All in one wordpress security and firewall.
    – Wordfence.

    – (For speed: Wp Super Cache, or whatever).

    (I.e.

    Well, now let’s go to the following:

    THE USER NAME MUST BE PRIVATE.

    At the moment there is a Vulnerability in both WordPress and BuddyPress.

    LOOK AT THE PHOTOS.

    If you publish something, and you click Right
    On the Public Name, the User Name is displayed in the URL.

    WordPress (Blog):

    www.yoursite.com/author/your-username

    SweetDate (Messages, WidGets, Comments, etc.):

    COPY CODE
    
    https://seventhqueen.com/demo/sweetdatewp/members/demo/messages/

    BuddyPress:

    www.yoursite.com/members/your-username

    BbPress:

    www.yoursite.com/forums/profile/your-username

    This is so wrong. IS NOT SAFE.

    If you go to the Profile of any user, it shows:

    Your Public Name
    @your-username

    This should not be like that.

    Therefore, you must create a PHP Function that FORCES to display only the NickName:

    Profile:

    Your Public Name
    @your-nickname

    URLs:

    COPY CODE
    
    www.yoursite.com/members/your-nickname
    
    www.yoursite.com/author/your-nickname
    
    www.yoursite.com/forums/profile/your-nickname
    
    seventhqueen.com/demo/sweetdatewp/members/YOUR-NICKNAME/messages/

    ********* PLEASE, CHECK THIS LINK

    ———-

    NickName and Public Name will be automatically created according to First Name and Last Name.

    The idea is that the Username of All users is Private.

    On the Registration Form (WP / BP).
    If a user enters his User Name just like the Full Name, he should receive an Alert:

    Please enter a different username, it can not be the same as your Full Name.

    ———

    NOTE:
    Includes (KLEO functions) reCaptcha

    In: Registration Forms, I forgot my Password, Login,

    So that they do not affect the Login for Subscribers.

    The All In On Wp Security and F plugin adds a Captcha but affects User Login.

    ———
    * SPEED: Check your Theme (sweetdate/demo) using GTmetrix and Page Speed ​​Insights.

    I. e. Minify Css and Js.

    I you want: Includes (only for specific css):
    LoadCSS.js

    This plugin: Speed Up – Optimize CSS Delivery by Simone Nigro, Resolves this request for PageSpeed, but, affects the Theme, because there are some sensitive CSS. So, you can adapt the Code.

    AND: Your Theme has problems with the Css for Mobile: Things misaligned, Buttons too large, etc. Remember that!

    Attachments:
    You must be logged in to view attached files.
    in reply to: How can I hide, or remove author from… #151168
     Roader
    Participant
    COPY CODE
    if( current_user_can('editor') || current_user_can('administrator') ) {  
      $author = sprintf( '<a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a>',
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		esc_attr( sprintf( __( 'View all posts by %s', 'kleo_framework' ), get_the_author() ) ),
    		get_the_author()
    	);  
    }


    And the code is??
    Radu, remember, I dont know php…
    This feature is a solution for a problem of security, I know that you understand.

Viewing 40 posts - 1 through 40 (of 68 total)

Log in with your credentials

Forgot your details?