how to change the link in the wordpress email with newpassword? - wordpress

how to change the link in the wordpress email with newpassword?
this information we get when we click on forgot password.
username : admin
password : admin
http://www.example.com/wp-login.php
here i want to change this url "http://www.example.com/wp-login.php" and set my own url... how can i do?
some reference code:
if ( !function_exists('is_user_logged_in') ) :function is_user_logged_in() {
$user = wp_get_current_user();

You can hook into the retrieve_password_message filter
function someFunction($message, $key){
}
add_filter('retrieve_password_message', 'someFunction');
You would then have to use the "someFunction" function to parse the $message variable and change the link.
The message variable contains the entire message. So you could simply trim the message based on the number of characters then tack on your new link...
HTH
(Untested)

Using hooks would be my first thought so that you wouldn't have to edit any core files, however I have used the SB Welcome Email Editor plugin a couple times for this exact reason. Their are a couple plugins like this out their and they are fairly light weight and allow full customization of all Wordpress generated emails.

Try using a plugin such as Theme My Login, which does everything for you.
Editing core wordpress files is never a good idea, when updating wordpress, you'll loose all your work.

You can simply follow steps if you want to edit your code file.
Go to your wordpress folder. Look for the following files:
1. /wp-login.php
2. /includes/functions.php
Change the all the codes which contains wp-login.php into your custom URL.
for example: admin.php or client-login.php
Now you can changed your login/signup URL into your custom URL.
Known issue: You can find some database error if you make any mistakes. Just refresh the page and try with the customized Url it will work...
Example site I used here : http://androideveloper.com/admin.php from http://androideveloper.com/wp-login.php
Cheers.

Related

Restrict access to comments in WordPress using the plugin Restrict Content Pro

I would like to ask if someone can help me with this question. I can't find anywhere how to do it.
I have a website with Wordpress as a CMS. I use the plugin Restrict Content Pro to restrict access to exclusive content.
I share the post in freemium mode.
And now the question:
How could I restrict access to post comments?
I guess through something in the php code, but I don't know how.
Can anybody help me?
Thank you!
I don't use this plugin myself, but just found a good looking tutorial. Apparently, you restrict access to comments in the same way that you restrict access to anything else: By only outputting it in the theme files when the user has access to it. For example, the TwentyTwentyOne theme has a file "comments.php", which starts like this:
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password,
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
$twenty_twenty_one_comment_count = get_comments_number();
?>
You can easily add another check beneath the password check:
/**
* Check if the user has access, don't output the comments if they don't.
*/
if ( !rcp_user_has_active_membership() ) {
return;
}
Of course, instead of returning you can also output something along the lines of "get a membership to see the comments".
The tutorial I found lists different ways to check for a membership, a paid membership and more special checks.
Two more things:
Be sure to check if there are other places where comments are displayed. That very much depends on how the WordPress theme is built.
Don't just change the theme if it comes from an external source, e.g. if it might receive updates in the future. In that case create a child theme and make your changes there instead. You can read more about child themes in the Theme Handbook.

Create an external link on wordpress site passing the username as a querystring parameter

I am adding a quick link on my wordpress site but that link is a custom link that redirects with the current username thats logged in. So, the link would be something like "http://www.example.com?currentuser={username}". I want this {username} to come from the system but I am not able to find either the right token for it or not sure what I am doing is correct? I am trying to add a quick link -> custom link on my site but needs the current username to be able to pass to as my querystring parameter. How should I go about accomplishing this on the wordpress site?
Try if following is useful.
$current_user = wp_get_current_user();
$loggedinuser = $current_user->user_login;
$linkurl = get_site_url().'/?currentuser='.$loggedinuser;
$displaylink = 'Click Here';
echo($displaylink);

Duplicated permalinks on a wordpress page

First I have www.mywebsite.com/blog/ Which is another wordpress Blog under www.mywebsite.com.
Then I created a page inside www.mywebsite.com which has a url of www.mywebsite.com/blog/.
I want to change the first www.mywebsite.com/blog into www.mywebsite.com/blog2 so It won't confuse me anymore.
After changing the permalinks in the admin panel. I can't access www.mywebsite.com/blog anymore.
Is there any way to access the page of the original www.mywebsite.com/blog2/wp-admin? and view the duplicated page www.mywebsite.com/blog/?
Please comments if my question confuses you.
Thanks.
When moving your site, give the guide to moving wordpress or, in this case better, the guide of changing the wordpress url a glance.
Suppose you changed the URIs where you cannot move the files, but still can access the login page (through a redirection or something) you can recover your installation easily.
wp-login.php can be used to (re-)set the URIs. Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
run it (once) and you are done. Test your site to make sure that it works right. If the change involves a new address for your blog, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location. Delete those lines from your wp-login.php.

PHP echo function in BuddyPress to Hyperlink to Member Profile Pages

When I first setup BuddyPress on my site, root profiles were enabled. Basically, if a registered user wanted to edit the account settings of their profile, the URL where they could do that would be: "domain.com/username". However, if you typed in "domain.com/members/username" in your browser, you would get the exact same page.
I decided I did not want root profiles enabled because I preferred the URL to be: "domain.com/members/username", so based on this guide (http://codex.buddypress.org/extending-buddypress/changing-internal-configuration-settings), I edited the code in functions.php to be like this:
define ( 'BP_ENABLE_ROOT_PROFILES', false );
However, in header.php, where my navigation is located, the PHP function is still linking to the root profile that I wanted disabled. This is what it looks like:
Profile
I am trying to figure out how I can change the function so that it links to: "domain.com/members/username" instead of "domain.com/username".
Please remove the define ( 'BP_ENABLE_ROOT_PROFILES', false ); in your function.php file.
Because the Buddypress default provide domain.com/members/username.
And also please check the wp-config.php file if above code is there just remove it
Please try this

How do I prevent Wordpress from stripping the "at" sign (#) from the URL query string?

I am trying to pass an email address to a wordpress page like so:
http://www.website.com/?email=fakeemail#yeahwho.com
However, Wordpress turns it into this:
http://www.website.com/?email=fakeemailyeahwho.com
I even try URL encoding it like so:
http://www.website.com/?email=fakeemail%40yeahwho.com
But Wordpress is too smart and still removes the %40.
I understand that # is a reserved character, but I should be able to still use the URL encoded version. Alas, Wordpress does not want it to be so.
How can I force Wordpress to respect the # sign? I'm guessing I'll either have to hack the internals, or do some mod_rewrite magic.
from http://www.webopius.com/content/137/using-custom-url-parameters-in-wordpress
First, add this to your theme's functions.php file (or make a custom plugin to do it):
add_filter('query_vars', 'parameter_queryvars' );
function parameter_queryvars( $qvars )
{
$qvars[] = 'email';
return $qvars;
}
Next, try passing ?email=fakeemail-AT-yeahwho.com in the URL and then converting it back with something like this:
global $wp_query;
if (isset($wp_query->query_vars['email']))
{
$getemail = str_replace( '-AT-', '#', $wp_query->query_vars['email']);
}
// now use $getemail
This would only not work in the very rare occurrence of an email that actually has "-at-" in it. You could replace for an even more obscure string like '-AT6574892654738-' if you are concerned about this.
Whatever your final solution, don't hack the core to get it to work. :)
I was having a similar problem and I was able to isolate the issue to an SEO plugin. I'm sure the plugin added a filter to the functions.php but as the plugin wasn't being used uninstalling the plugin also resolved the issue.
I also had this problem, but it wasn't caused by a plugin. It was a result of the 301 redirect that WordPress does with regard to your Site URL having, or not having, a www. in it.
If my Site URL was defined as http://www.mydomain.com, then this would work as expected: http://www.mydomain.com/?email=user#domain.com
If the user came to the site as: http://mydomain.com/?email=user#domain.com (NOTE: no www), then WordPress would redirect to this: http://www.mydomain.com/?email=userdomain.com (NOTE: the stripped # symbol)
My solution was to hard code the www redirect in the htaccess file, so WordPress would never have the opportunity to mess with my URL. This page gives example htaccess lines to redirect non www to www and vice versa: http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/
I was having a similar problem today when trying to pass Mailchimp data through to a Gravity Form in Wordpress. I found a solution. The original question stated that Wordpress was also stripping %40, but it didn't for me in this instance.
1) In Mailchimp create a new Merge tag. I called mine 'Email Param' and * |EMAIL2| *
2) Export your list of subscribers
3) Copy the normal 'email' column content into the new 'Email Param' column.
4) Do a Find and Replace for all # symbols to %40
5) Import your list and tick the box that Auto-updates that list
6) Update your URL to include the new parameter
* |EMAIL2| *
That worked for me.

Resources