Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts

    How to change a weblink in php file?

    Hi there

    Apologies if I have posted this in the wrong forum - I'm a newbie who is rather lost with an issue that I am having with my website and could do with some guidance.

    The reason why I've posted this in php forum is because the majority of the backend files on the server appear to be php files.

    I had a website built for me by a web developer a couple of years ago and would now like to change the web address of a link that's on the menu header.

    The current link is "Blog" and has the address http://www.website.com/category/blog. I want to change the address of this link to http://www.website.com/blog.

    How should I go about doing this? I can access all the back end files using FTP, but don't know which file to modify.

    To identify the link, I thought I would try to "View Source" while on one of the webpages - I can search for the link which brings up the following (i've copied what I think is the relevant snippet below):


    <div id="navigation">
    <div class="menu-header"><ul id="menu-mainmenu" class="menu"><li id="menu-item-16" class="menu-item menu-item-type-post_type menu-item-16"><a href="http://www.website.com/about/">About</a></li>
    <li id="menu-item-15" class="menu-item menu-item-type-post_type menu-item-15"><a href="http://www.website.com/portfolio/">Portfolio</a>
    .
    .
    .
    .
    <li id="menu-item-17" class="menu-item menu-item-type-taxonomy menu-item-17"><a title="Blog" href="http://www.website.com/category/blog/">Blog</a></li>
    </ul></div></div>

    Can anyone help please? Many thanks in advance.

    Cheers

    benobi

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    It looks like this is a wordpress site... is that true?

    And nah, that code is not relevant at all, as if its a PHP site, and indeed a wordpress site, it has nothing to do at all with the HTML, its all about the PHP.

  • Users who have thanked Keleth for this post:

    benobi (07-11-2012)

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Log into the admin dashboard of your WP site.

    Mouse to the "Appearance" item and within
    that drop-down menu is a link called "Editor".

    Now this is where things might be different.
    Each theme author may name their PHP scripts
    different things. On the list at the right of
    the editor page, look for a file that might have
    a name like:
    header_main.php
    header_blog.php

    You're going to be looking for the PHP script that
    displays that menu bar on your page(s).

    If you view that file in the editor, look for the part
    where the menu (navigation) is appearing. Copy
    and post that script here.

    The editor you're using is the tool you will be using to make changes.

    =========

    Alternatively, if that menu/navigation portion is not within the PHP script ...

    Because themes are created by different authors, the theme features
    are usually done differently. I sort of expect you may find something in
    the admin section where you can modify a part of your theme. That menu
    or navigation part you're talking about might be a "setting" for a part
    of your theme ... where each of those menu links can be modified. So
    instead of looking at the PHP scripts (templates), you'll be looking for a
    "Theme settings, or theme features" link to modify content. This method
    will be a different link in the "Appearances" tab ... not "Editor", but
    some other name.


    .
    Last edited by mlseim; 07-11-2012 at 04:27 PM.

  • Users who have thanked mlseim for this post:

    benobi (07-11-2012)

  • #4
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Indeed it is a wordpress site - thanks for your comments so far. I will give it a go shortly to see if this works. Will let you know. Cheers!

  • #5
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Log into the admin dashboard of your WP site.

    Mouse to the "Appearance" item and within
    that drop-down menu is a link called "Editor".

    Now this is where things might be different.
    Each theme author may name their PHP scripts
    different things. On the list at the right of
    the editor page, look for a file that might have
    a name like:
    header_main.php
    header_blog.php

    You're going to be looking for the PHP script that
    displays that menu bar on your page(s).

    If you view that file in the editor, look for the part
    where the menu (navigation) is appearing. Copy
    and post that script here.

    The editor you're using is the tool you will be using to make changes.

    =========

    Alternatively, if that menu/navigation portion is not within the PHP script ...

    Because themes are created by different authors, the theme features
    are usually done differently. I sort of expect you may find something in
    the admin section where you can modify a part of your theme. That menu
    or navigation part you're talking about might be a "setting" for a part
    of your theme ... where each of those menu links can be modified. So
    instead of looking at the PHP scripts (templates), you'll be looking for a
    "Theme settings, or theme features" link to modify content. This method
    will be a different link in the "Appearances" tab ... not "Editor", but
    some other name.


    .
    Hi mlseim

    Damnit - I think the account that the web developer gave me is only the role "Editor", not Admin. Can't see any section in WP that matches your description for a drop down link 'Appearance' or 'Editor'. The only one I can see is "User Role Editor" but when I click that it says "access is forbidden".

    Is there any other way I can make this change?

    Cheers

    Ben

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    If you're not an admin, you can go into the database to make changes directly, but its difficult to do without screwing up the database without a decent understanding of mysql/php.

  • Users who have thanked Keleth for this post:

    benobi (07-11-2012)

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Ben ...

    Let me take a look at this later when I am able to get into my MySQL account
    and see where the users database is stored. I wonder if there might be a column
    in the user's table where you could change your level from editor to admin.
    I'll look closer to see, and let you know what I find.

    But you are correct ... you'll need an admin login to do this.

  • Users who have thanked mlseim for this post:

    benobi (07-11-2012)

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Ben ...

    Are you able to access the MySQL database using "phpMyAdmin"?
    That's the program to access your database using your control panel?

    Let me know if you can get that far.

    If you can, try to find your "user ID" in the wp_users table.
    Then, this script will allow you to switch levels:
    http://www.redbridgenet.com/wordpres...-capabilities/


    .

  • #9
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Ben ...

    Are you able to access the MySQL database using "phpMyAdmin"?
    That's the program to access your database using your control panel?

    Let me know if you can get that far.

    If you can, try to find your "user ID" in the wp_users table.
    Then, this script will allow you to switch levels:
    http://www.redbridgenet.com/wordpres...-capabilities/


    .
    Hey there

    Yes I can access phpMyAdmin via cPanel.

    I found the following databases, but not sure what to do with them?


    _wrdp1
    _wrdp2

    information_schema

    Bit scary though as to what I am doing so maybe I should run through this with you on a private chat first.

    Cheers

    Ben

  • #10
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    In the root of your wordpress install, you'll find a file called wp-config.php, and in there it'll tell you what database your site is using. Go to that database through PHPmyAdmin then follow the instructions on the site mlseim listed.

  • Users who have thanked Keleth for this post:

    benobi (07-13-2012)

  • #11
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Hi all

    Thanks so far for comments on this. I've checked the wp-config file and the _wrpd2 is the correct DB. (the _wrpd1 DB is the DB for my new blog)

    However.... I wonder if there is another option here?

    I've just logged into the wp_user table for _wrpd2 and I see a user_login account called "admin", which speaks for itself I guess.

    There are also a number of columns in this DB, one of them is user_pass with a character string showing for each account (is this a hex string?)

    Rather than hack the DB to change the role on my editor account, can I just extract or change the password that is showing up under the admin account?

    There's the option to Edit each user account, and there appears to be a password field under the options. But I don't want to change anything yet without some advice.

    Thoughts?

    Cheers

    Ben
    Last edited by benobi; 07-13-2012 at 11:09 AM. Reason: adding detail

  • #12
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    That password is encrypted. You can't decode it.

    When you look at those names in that DB table, what is your user ID?
    If there are 4 users, the user ID will be 1,2,3 or 4.

    Keleth ...
    Ben knows what his password is ...
    What do you think about the idea of Ben using the phpAdmin to copy his
    encrypted password and pasting it in the row for the admin user?
    He'll be changing the admin password to his own.

    That might work?


    .
    Last edited by mlseim; 07-13-2012 at 12:31 PM.

  • Users who have thanked mlseim for this post:

    benobi (07-13-2012)

  • #13
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    That password is encrypted. You can't decode it.

    When you look at those names in that DB table, what is your user ID?
    If there are 4 users, the user ID will be 1,2,3 or 4.

    Keleth ...
    Ben knows what his password is ...
    What do you think about the idea of Ben using the phpAdmin to copy his
    encrypted password and pasting it in the row for the admin user?
    He'll be changing the admin password to his own.

    That might work?


    .
    The Admin ID=1.
    My Editor ID=3.

    I tried copying and pasting my encrypted password into the password field of a guest account (which I had set up a while back) to test whether it would pick up my password. It certainly did! I changed it back to the original encrypted password and again it updated ok.

    But can someone confirm if this would be ok to do the same on the admin account? Or because this is special account, would it be a problem to do this?

  • #14
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    yes this will work

  • Users who have thanked Arcticwarrio for this post:

    benobi (07-13-2012)

  • #15
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Yea .. .try it.
    You don't know the admin password anyhow, so you can't make it worse than it is.

    If that does work, you should be able to log-in as admin and then
    edit your templates. If you already have FTP access, you could edit
    them manually (without logging into WP). I originally assumed you
    were not comfortable with editing the PHP files using FTP (and Notepad).

  • Users who have thanked mlseim for this post:

    benobi (07-13-2012)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •