Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 409 | 410 | (Page 411) | 412 | 413 | newer

    0 0

    I have my "own" registration system and I want users to verify their email. Since there is no builtin function for that I use the "get_password_reset_key( $user )" function since it will generate a key which I can verify with "check_password_reset_key( $_REQUEST['key'], $_REQUEST['login'] );".

    It works great, but it would be nice to have the same functions with the appropriate naming. After all we all want to fight spam and requesting users to verify their email is important.
    So basically this is what I mean:

    get_email_verification_key( $user_data );
    
        $message = __('This is an email verification for the following account:') . "\r\n\r\n";
        $message .= network_home_url( '/' ) . "\r\n\r\n";
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
        $message .= __('If email was verified already, just ignore this email and nothing will happen.') . "\r\n\r\n";
        $message .= __('To verify your email, visit the following address:') . "\r\n\r\n";
        $message .= '<' . network_site_url("email-verification?action=ve&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
    
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    
        $title = sprintf( __('[%s] Email Verification'), $blogname );
    
        /**
         * Filter the subject of the email verification email.
         * @param string  $title      Default email title.
         * @param string  $user_login The username for the user.
         * @param WP_User $user_data  WP_User object.
         */
        $title = apply_filters( 'retrieve_email_title', $title, $user_login, $user_data );
    
        /**
         * Filter the message body of the email verification mail.
         * @param string  $message    Default mail message.
         * @param string  $key        The activation key.
         * @param string  $user_login The username for the user.
         * @param WP_User $user_data  WP_User object.
         */
        $message = apply_filters( 'retrieve_email_message', $message, $key, $user_login, $user_data );
    
        if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
        {
            $_SESSION["home_error"] = "Verification email could not be sent";
            exit;
        }

    And to verify simply do this:

    $user = check_email_verification_key( $_REQUEST['key'], $_REQUEST['login'] );

    0 0

    Hello there!

    "Auto term creation in a specific taxonomy according to a defined CPT post title"

    I've found the bellow code and it works perfectly but one thing is missing!
    I need the post being created to be assign to the automatically created taxonomy.

    Any help please?

    Source code: https://wordpress.org/support/topic/auto-term-creation-in-a-specific-taxonomy-according-to-a-defined-cpt-post-title?replies=3

    function add_new_term() {
    $args = array(
    'posts_per_page' => -1,
    'post_type' => 'labels'
    );
    $title_query = get_posts('numberposts=-1&post_type=labels');

    foreach ($title_query as $single_post) {

    $title = get_the_title($single_post->ID);
    $taxonomy = 'label';
    $exist = term_exists($title, $taxonomy);

    if ( $exist == FALSE )
    {
    wp_insert_term($title, 'label');

    }
    }
    }
    add_action('init','add_new_term');


    0 0

    I have a plugin file in which I pass a query and retrieve data from it. But i dont want anyone to acees it publicly.
    I tried if ( ! defined('ABSPATH')) exit('restricted access'); in my PHP file but that restricted me to get feed when I ran it fetch_feed($feedurl).
    is there a way to use both


    0 0

    For my documentation site http://www.wppa.nl/ I need wp_texturize to be switched off.

    I read somewhere how to do this properly so I wrote a simple plugin:

    <?php
    /*
     * Plugin Name: F*ck wptexturize
     * Description: Disables wptexturize
     * Version: 0
     * Author: J.N. Breetvelt a.k.a. OpaJaap
     * Author URI: http://wppa.nl/
     * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
     */
    
    if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
    
    // Debugging
    // error_reporting( E_ALL );
    
    // Switch off wptexturize
    add_filter( 'run_wptexturize', '__return_false' );

    However, a double quote is still destructified into an 'italic' version, like the inch symbol, when it appears right after an integer.

    i.e. album="$piet" is untouched, but in album="3", the last double quote is damaged. See http://beta.opajaap.nl/test-page/


    0 0

    I'm having an issue which is caused by custom query var named date I've added using query_vars hook. When date parameter is present in the front page URL (https://example.com/?date=23.08.2016), WordPress is loading posts archive instead of just front page. When other random params are added to the link (https://example.com/?foo=bar) or no params are present, front page is loaded correctly the static page I defined.

    Posts page in the backend is different than front page.

    I added custom query var using following code:

    my_query_vars( $vars ) {
        $vars[] = 'date';
        return $vars;
    }
    add_filter( "query_vars", "my_query_vars" );

    Any idea why such a thing happens?


    0 0

    Hello, i am creating a blog about cat food and im uploading unique content. but i saw many of post are being copied by some jerks. how to prevent copy text from my blog??
    thank you


    0 0

    I am trying to get this tutorial to work in WordPress. I am not able to get it to update the second drop down box. how-to-create-chained-select-with-php-and-jquery/ Getting error Undefined index: id For now I am just running it in my header file and the other two files are in my theme folder. One person on there recommended changing the line to point to "http://mysite.com/wp-content/themes/my-theme-name/select_type.php" and that didn't work.


    0 0

    Hello,
    for my design it is more complaisant to use shortcodes instead
    of url because the shortcode provides some additional formatting.

    Example:
    When you like to have a shortcode resolved by a main menu item,
    this seems not to be possible and also plugins are not really working
    (in my case).

    When you like to add a RSS feed to sidebar, only an URL is accepted,
    not a shortcode which could implement this RSS more convenient.

    (To be able to use shortcodes where ever URL is accepted would be a nice
    standard feature for next WP release. If you can't extract url from shortcode -> 404).

    My question:
    Is there a general workaround to use shortcodes in URL fields, like functions handle this ?
    Thank you


    0 0

    Hi,

    I want to upload files to an additional upload folder. All files with 'canada' in their name.

    I use upload_dir to create a custom upload folder:

    function custom_upload_dir( $custom_dir ) {
    	$dir = WP_CONTENT_DIR . '/userfiles';
    	$url = WP_CONTENT_URL . '/userfiles';
    
    	$bdir = $dir;
    	$burl = $url;
    
    	$custom_dir = array(
    		'path'    => $dir,
    		'url'     => $url,
    		'basedir' => $bdir,
    		'baseurl' => $burl,
    		'error'   => false,
    	);
    	return $custom_dir;
    }
    add_filter( 'upload_dir', 'custom_upload_dir' );

    Now all uploaded files are listed in the userfiles directory.

    So I thought including this does the trick:

    $mystring = $_SERVER["REQUEST_URI"];
    $findme = 'canada';
    $pos = strpos($mystring, $findme);
    
    if ($pos === true) {

    But no!

    I notice this in codex:

    Using this, in conjunction with the wp_handle_upload_prefilter, you can dynamically determine which directory to upload to, based on the files you upload.

    But, how can I do that?

    Guido


    0 0

    Not sure if I should file a bug report or if I'm doing something wrong here.

    I have a plugin that adds a custom column to the user table in the admin, but when I add another plugin that does the same thing, the value from my plugin doesn't show up in the column.

    If I comment out the line in the other plugin, then I get my column value back.

    Help!

    Here is my plugin code that adds the column and shows the value:

    add_filter('manage_users_columns', 'add_rep_group_column');
    function add_rep_group_column($columns) {
        $columns['rep_group'] = 'Rep Group';
        return $columns;
    }
    
    add_action('manage_users_custom_column',  'show_rep_group_column_content', 10, 3);
    function show_rep_group_column_content($value, $column_name, $user_id) {
            $rep_group_id = get_user_meta($user_id, 'rep_group', 1);
            if ( 'rep_group' == $column_name )
                    return get_the_title($rep_group_id);
        return $value;
    }

    And here is the code I comment out in disable-users/init.php to get my column value back:

    add_action( 'manage_users_custom_column', array( $this, 'manage_users_column_content' ), 10, 3 );


    0 0

    Hello, I’ve upgraded an older site that utilized the source code button. I had previously just customized the buttons that appeared via a simple script in functions. This no longer works for 'code' and it seems as though WP has done away with the source code component of TinyMCE? I have tried to use TinyMCE Advanced but the source code is also not working in 4.6 and I’ve been unable to get any support on that front. Since I really just need this one button, I'm wondering if there is a simple way to add this back in as it is important at this time. Thanks.


    0 0

    I'm so very close to being able to release a free plugin.

    Upon uploading media, my plugin automatically transfers audio and video files to an external server (Archive.org). The part that I'm hung up on is the progress bar, showing the progress of transferring the file to Archive.org. But instead of a smoothly growing progress bar, it stays at 0% and then jumps to 100% once it's done.

    Relevant code from the plugin:

    // Set all the options if they don't exist yet
    add_option('aou_accesskey',"");
    add_option('aou_secretkey',"");
    add_option('aou_progress',"");
    update_option('aou_progress','0');
    
    function progressCallback( $download_size, $downloaded_size, $upload_size, $uploaded_size ){
        static $previousProgress = 0;
    
        if ( $upload_size == 0 )
            $progress = 0;
        else
            $progress = round( $uploaded_size * 100 / $upload_size );
    
        if ( $progress > $previousProgress){
            $previousProgress = $progress;
            update_option('aou_progress',$progress);
    	    }
    	}
    
    function aou_upload_file($file) {
    	$ias3accesskey = get_option('aou_accesskey',"");
    	$ias3secretkey = get_option('aou_secretkey',"");
    
    	$filename = str_replace(' ', '-', $file['name']);
    	$file_no_ext = preg_replace('/\\.[^.\\s]{3,4}$/', '', $filename);
    
    	$file_read = fopen($file['tmp_name'], 'r');
    	$upload_file_url = 'http://archive.org/download/' . $filename . '/' . $filename;
    
    	$headers = array(
    'Authorization: LOW ' . $ias3accesskey . ':' . $ias3secretkey,
    'x-amz-auto-make-bucket:1',
    'x-archive-meta01-collection:opensource_' . $mediatype,
    'x-archive-meta-title:' . $file['name']
    );
    
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    	curl_setopt($ch, CURLOPT_HEADER, true);
    	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    	curl_setopt($ch, CURLOPT_URL, 'http://s3.us.archive.org/' . $filename . '/' . $filename);
    	curl_setopt($ch, CURLOPT_PUT, true);
    	curl_setopt($ch, CURLOPT_INFILE, $file_read);
    	curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file['tmp_name']));
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_VERBOSE, false);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_NOPROGRESS, false );
    	curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback');
    	curl_setopt($ch, CURLOPT_BUFFERSIZE, 25);
    	curl_exec($ch);
    	curl_close($ch);
    	fclose($file_read);
    
        return $file;
        }
    
    add_filter('wp_handle_upload_prefilter','aou_upload_file');
    
    function aou_css_head() {
    	global $pagenow;
    
    	if ($pagenow == 'media-new.php'){ ?>
    		<style type="text/css">
    		#aou_progress {
    		  display:block;
    		  height:15px;
    		  background-color:#ddd;
    		  text-align:right;
    		  overflow:hidden;
    		  font-size:10px;
    		  color:#aaa;
    		  position:relative;
    		  padding-right:3px;
    		}
    		#aou_progress_bar {
    		  position:absolute;
    		  top:0;
    		  left:0;
    		  width:0%;
    		  height:15px;
    		  background-color:#cdf;
    		  padding-right:3px;
    	      overflow:hidden;
    	    }
    	    </style>
    
    	    <script>
    
    		window.setInterval(function(){
    			var xhttp = new XMLHttpRequest();
    			xhttp.onreadystatechange = function() {
    				var progressElement = document.getElementById('aou_progress_bar');
    				if (xhttp.readyState == 4 && xhttp.status == 200 && progressElement.innerHTML != '100%') {
    					progressElement.style.width = xhttp.responseText + '%';
    					progressElement.innerHTML = xhttp.responseText + '%';
    					}
    				};
    			xhttp.open("GET", "http://<?php echo $_SERVER['SERVER_NAME']; ?>/wp-content/plugins/archiveorg-uploads/progress.php", true);
    			xhttp.send();
    			}, 125);
    
    		</script>
    <?php
        	}
        }
    
    add_action('admin_head', 'aou_css_head');
    
    function aou_progress_bar() {
        global $pagenow;
        if ($pagenow == 'media-new.php'){
    	    echo '<div id="aou_progress">Archive.org Uploads Progress<div id="aou_progress_bar">0%</div></div>';
    		}
    	}

    add_action('all_admin_notices','aou_progress_bar');`

    <strong>progress.php</strong>

    <?php
    require_once('../../../wp-load.php');
    global $wpdb;
    echo $wpdb->get_var( "SELECT option_value FROM wp_options WHERE option_name='aou_progress'" );
    ?>

    So, so basically, the callback of the upload updates the aou_progress option in the database, and this option is written via progress.php, which should be checked for changes every 1/8 second, and the progress bar should grow.

    But obviously I did something wrong here. I'm wondering if it can't check progress.php for a change while it's transferring the file via curl? If that's true, is there a way to get around it?


    0 0

    I'm having some problems with date_i18n. It's giving me inconsistent results and I can't understand why. All three machines have the WordPress time zone configured to America/Chicago. If i call this code:

    $result.="\n<!-- Format: "
    	.$tdata->time_format." Converted: "
    	.date_i18n($tdata->time_format,1472231212).
    	" -->\n";

    On one machine running WordPress 4.6 and PHP 5.5.35, the output is:

    <!-- Format: g:i a Converted: 12:06 pm -->

    Another machine running WordPress 4.6 and PHP 5.5.14 returns:

    <!-- Format: g:i a Converted: 5:06 pm -->

    A third machine running WordPress 4.6 and PHP 5.6.1 (openSUSE w/ Patches) also returns:

    <!-- Format: g:i a Converted: 5:06 pm -->

    The timestamp in the call, is Fri, 26 Aug 2016 17:06:52 GMT. So, in the first system, date_i18n() is converting the time from GMT to local time, while on the other two systems it is not.

    Can anyone help me understand what's causing this?


    0 0

    Hi guys,
    I just read 'Warning: Do not use variable names for the text domain portion of a gettext function. Do not do this as a shortcut: __( ‘Translate me.’ , $text_domain );'
    and that is fine with me, I don't use variable names.
    However, I use constant.
    So... is it ok to use constant? It works... what can possibly go wrong?


    0 0

    Please I added the code below to my functions.php file so i can display my blog's 12 most recent registered users in a table, you can view the demo at https://nairalake.com/test-recent-members-display/
    but the problem I'm having is how to make the date display like 20/11/2015 instead of the default format which is 2015-11-20 22:22:08

    Please I only want to show the date without time.

    function wpb_recently_registered_users() {
    
    global $wpdb;
    
    $recentusers = '<ul class="recently-user"><table width="500px" border="2">';
    
    $usernames = $wpdb->get_results("SELECT user_nicename, user_registered, user_url, user_email FROM $wpdb->users ORDER BY ID DESC LIMIT 12");
    
    foreach ($usernames as $username) {
    
    if (!$username->user_url) :
    
    $recentusers .= '<tr><td width="250px"><b>' .$username->user_nicename." </b></td><td><b> ".$username->user_registered."</b></td></tr>";
    
    else :
    
    $recentusers .= '<li>' .$username->user_nicename."</li>";
    
    endif;
    }
    $recentusers .= '</table></ul>';
    
    return $recentusers;
    }

    0 0

    Hi

    I am looking for a way to modify or create a post link that will auto populate the title - the visibility , category and tag ..

    For example the standard link

    myweb.net/wp-admin/post-new.php

    would be

    myweb.net/wp-admin/private-goals-new.php

    and create a a post with the auto populated title.

    Goals : 09/26/2016

    and create the visibility as private and set the category and tag to : goals

    thanks


    0 0

    I'm a graphic designer and want my   (non-breaking space) characters to stay where I bloody-well put them without the visual editor stripping them out again. If you're a typography dick like me, this is handy to make two or more specific words wrap together rather than breaking at the spaces.

    For example, if you want "South Australia" not to break in an address.

    So, I wrote added a simple shortcode via my child-theme's functions.php:

    //[nbsp] shortcode
    function nbsp_shortcode( $atts, $content = null ) {
    	$content = '&nbsp';
    	return $content;
    }
    
    add_shortcode( 'nbsp', 'nbsp_shortcode' );

    Then I just use:
    [nbsp]
    Instead of:
    &nbsp;

    Hope this helps someone.

    Pt.


    0 0

    hello everybody,

    i want to simply hide wordpress default login form because i use wordpress.com login which i find more secure. here is a picture

    Thank you


    0 0

    Hi,

    I need some help with this bit of code ... the thing is I am trying to deny access to a role name for a specific part of the admin area.

    /*
     * If user is not a SuperAdmin, when they try to access the below URLs they are redirected back to the dashboard.
     */
    function restrict_admin_with_redirect() {
    
    	$restrictions = array(
    		'wp-admin/admin.php?page=wpca-settings'
    			);
    
    	foreach ( $restrictions as $restriction ) {
    
    		if ( ! current_user_can( 'manage_network' ) && $_SERVER['PHP_SELF'] == $restriction ) {
    			wp_redirect( admin_url() );
    			exit;
    		}
    
    	}
    
    }
    add_action( 'admin_init', 'restrict_admin_with_redirect' );

    I am placing this code to my functions php but I can not get it to work.

    Any help would be much appreciated


    0 0

    Hi!

    I have a jquery code with shortcodes from the plugin draw attention, and im struggling to try to hide some divs shortcodes, before I use jQuery show.

    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    			jQuery( document ).ready(function() {
    			        jQuery('.showSingle').on('click', function() {
    			            jQuery('.targetDiv').hide();
    			            jQuery('#div'+$(this).attr('target')).show();
    			            e.preventDefault();
    			            });
    				});
    			});
    
    			<div class="buttons">
    				<a  class="showSingle" target="1"><button>1</button></a>
    				<a  class="showSingle" target="2"><button>2</button></a>
    				<a  class="showSingle" target="3"><button>3</button></a>
    				<a  class="showSingle" target="4"><button>4</button></a>
    			</div>
    
    			<div id="div1" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="48"]');?></div>
    			<div id="div2" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="87"]');?></div>
    			<div id="div3" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="92"]');?></div>
    			<div id="div4" class="targetDiv"><?php echo do_shortcode( '[drawattention ID="111"]');?></div>

    How can i hide div2, div3 and div4, before I click on button?


older | 1 | .... | 409 | 410 | (Page 411) | 412 | 413 | newer