• okay got a perplexing problem…had someone trying to help last week but I still have not been able to fix this…i will do my best to describe.

    I was asked to help fix some issues on a site that was created by someone else…the guy that owns the site has no more contact with the people who created it, so he can’t ask them to fix this issue.

    There is a form on the testimonials page. It is not set up through the contact form 7 on the dashboard. It is handled differently, i suspect because when someone submits a testimonial, it needs to be emailed to admin for approval, and once approved, automatically posts on the testimonial page.

    I have found where the form content is edited in the PHP, but there is nothing on there on where the email goes when the submit button has been clicked. I have scoured the html, php, and code inspector for CSS and cannot find it anywhere.

    There are 3 admin users on his site. The first one, is the username “admin” – the default that was first set up by the company that created his site…it has an email address that they set up…when the submit button is clicked on the testimonials page, the ensuing email goes to this email address. He was told by them the it had to be this way for some reason. He does have the emails set to forward to his email address (and he is another admin on the site with a different username), but he wants the original company off the site, and he wants those emails to go directly to him – basically to switch the user that receives that email.

    I did try to simply change the email address in that “admin” user, from his admin account, and it would not let me do that. I thought simply deleting that “admin” user account would prompt me to tell it how to handle all the user permissions and functions that are set to that “admin” user (assuming it lets me delete it) but then I’m afraid that the emails will then go to a user who no longer exists, and he won’t get any emails. I can try that but I’m not sure which files in the home directory i need to backup and restore if it screws that up.

    Im not sure if they set it up as a super admin, what that means, how to find out, and if there is anyway to overcome that if they did…

    I hope that i was able to accurately describe the issue…and any help someone could give would be greatly appreciated. One word of note…try not to talk to far over my head…LOL. i am pretty good at creating and working within wordpress sites, but many basic things i should understand easily, i do not. so please don’t get discouraged from helping if i ask questions to any responses, even if they sound like stupid questions.

    thanks guys

Viewing 15 replies - 1 through 15 (of 16 total)
  • Is it possible to share / email the form code?

    You can change the email address from MySQL database.

    Thread Starter jfores19

    (@jfores19)

    okay – i can open the mysql database in the hosting panel but not sure what to do with it. Never worked in databases before. There are two users in there but they don’t have the same screen name as the users in WP…so I’m not really sure how to manipulate it.

    what follows is the code that i found in a file in the editor called “comments-testimonials.php”. Now..it seems to have different fields than the actual form. If you look at the form page itself (www.visionmotorcycletours.com/testimonials) you will see only two fields, plus a captcha field, and then the submit button. However, when i copied the “text area” comment field and pasted it just below the first one in this PHP file…it added another comment text area on the site itself. thats how i knew this is the PHP that created the form.

    here s the code:
    <?php

    if (!empty($_SERVER[‘SCRIPT_FILENAME’]) && ‘comments.php’ == basename($_SERVER[‘SCRIPT_FILENAME’]))
    die (‘Please do not load this page directly. Thanks!’);

    if ( post_password_required() ) { ?>
    This post is password protected. Enter the password to view comments.
    <?php
    return;
    }
    ?>

    <?php if ( comments_open() ) : ?>

    <div id=”respond”>

    <div class=”cancel-comment-reply”>
    <?php cancel_comment_reply_link(); ?>
    </div>

    <?php if ( get_option(‘comment_registration’) && !is_user_logged_in() ) : ?>
    <p>You must be “>logged in to post a comment.</p>
    <?php else : ?>

    <form action=”<?php echo get_option(‘siteurl’); ?>/wp-comments-post.php” method=”post” id=”commentform”>

    <?php if ( is_user_logged_in() ) : ?>

    <p>Logged in as /wp-admin/profile.php”><?php echo $user_identity; ?>. ” title=”Log out of this account”>Log out »</p>

    <?php else : ?>

    <div>
    <label for=”author”>Name <?php if ($req) echo “(required)”; ?></label>
    <input type=”text” name=”author” id=”author” value=”<?php echo esc_attr($comment_author); ?>” size=”22″ tabindex=”1″ <?php if ($req) echo “aria-required=’true'”; ?> />
    </div>
    <!–
    <div>
    <label for=”email”>Mail (will not be published) <?php if ($req) echo “(required)”; ?></label>
    <input type=”text” name=”email” id=”email” value=”<?php echo esc_attr($comment_author_email); ?>” size=”22″ tabindex=”2″ <?php if ($req) echo “aria-required=’true'”; ?> />
    </div>

    <div>
    <label for=”url”>Website</label>
    <input type=”text” name=”url” id=”url” value=”<?php echo esc_attr($comment_author_url); ?>” size=”22″ tabindex=”3″ />
    </div>

    –>
    <?php endif; ?>
    <!–<p>You can use these tags: <?php echo allowed_tags(); ?></p>–>

    <div>
    <label for=”comment”>Testimonial</label>
    <textarea name=”comment” id=”comment” cols=”58″ rows=”10″ tabindex=”4″></textarea>
    </div>

    <div>
    <input name=”submit” type=”submit” id=”submit” tabindex=”5″ value=”Send Testimonial” />
    <?php comment_id_fields(); ?>
    </div>

    <?php do_action(‘comment_form’, $post->ID); ?>

    </form>

    It looks like the testimonials are handled by wp-comments.php:

    
    <form action=”<?php echo get_option(‘siteurl’); ?>/wp-comments-post.php” method=”post” id=”commentform”>
    

    I believe that means the emails for them will go to the email address set on the Settings -> General Settings page in the admin of your WordPress install.

    Thread Starter jfores19

    (@jfores19)

    sadly that is the first place i went and the email address in there is the correct one. I will attached two screen shots: first is the general settings page so you can see how its set up, with the email address. second is the “users” page. there you will see the different users and their roles. The top “admin” user is the one where all those emails go. The 3rd one “larry_admin” is where we want them to go, and ideally we’d like to delete the top “admin” user but i don’t want to screw things up more by doing that.

    general settings

    users

    Hope that helps??

    Are there any settings in the Admin -> Testimonials section that allow you to set a target email, or does that just list the Testimonials?

    Thread Starter jfores19

    (@jfores19)

    I have scoured that whole wordpress panel, the PHP codes, the code inspector for CSS and HTML and i have not been able to find ANYWHERE that tells that submit button to send email to that first admin email…where i can subsequently change it.

    The testimonials tab in WP actually has nothing under it but an initial post that said welcome to vision motorcycle tours, the comments section does have all the testimonials that have been posted but that is it. There are no settings or anything like that. I have been through the pages, the settings – nothing. the company set up a “custom fields” tab on the WP dashboard, and i have been through that as well. I can find no reference.

    I have started looking at home directory in the server and started looking through a lot of that PHP code on there but don’t really know what script to look for, or how to search for it. I went into the mysql databases but have never tried to mess with those so I’m not sure how to do that either.

    sorry if this is a baffling problem. Im doing my best to describe it correctly.

    Baffling problems are interesting. ??

    I’m out of ideas, though I can give you a couple of pointers on how to search for the email if it’s hard-coded somewhere.

    Looking through PHP code takes forever. Since you’re suspecting they hard-coded the old email address somewhere, there is a quick way to search for it you have SSH access to your server (you may have to ask for it on a shared hosting account). After logging in via SSH, you would change into the /public_html folder:

    
    cd public_html
    

    Then you can search for the email address in all the files:

    
    grep -ri '[email protected]' .
    

    Grep will list the file path, file name, and part of the code where it finds the string you’re searching for (everything within the single quotes).

    I don’t think the answer is in the database, but I’m not sure. I’m thinking more that it comes from wherever the Testimonials are coming from. Maybe your theme or a plugin?

    I’m just guessing here, but if the Testimonials are handled like comments, the emails may go to the “author” of the content. That might explain why they go to the original admin. It’s possible that if you deleted that old admin account and reassigned all the content to the user whose email you want the emails to go to, you would be in good shape. I know you don’t want to cause a problem by deleting the old admin until you’re sure it won’t cause an issue, but if you backed up the database before you did it, you could just restore the database if it doesn’t work and be back where you are now.

    If that doesn’t work, you could change the old admin’s email address to a forwarder/alias on your hosting account that sends the email to whomever you want.

    Thread Starter jfores19

    (@jfores19)

    there is a quick way to search for it you have SSH access to your server (you may have to ask for it on a shared hosting account). After logging in via SSH, you would change into the /public_html folder:

    Honestly i am not sure how to get into SSH, or if i have access to it. I can login to his go daddy account and direct to cpanel/files etc.

    I know you don’t want to cause a problem by deleting the old admin until you’re sure it won’t cause an issue, but if you backed up the database before you did it, you could just restore the database if it doesn’t work and be back where you are now.

    Thats what i was going to try but not sure which file/database to back up. go daddy does auto backups on this site daily, and i downloaded full backups but not sure what i would need to restore, or how to restore individual files or databases.

    It’s possible that if you deleted that old admin account and reassigned all the content to the user whose email you want the emails to go to, you would be in good shape

    again, that was my plan. But wanted to make sure i knew what to backup and restore if it it screws things up. if i do that, will it prompt me to reassign content and such or do i have to figure out how to do that manually?

    I don’t think the answer is in the database, but I’m not sure. I’m thinking more that it comes from wherever the Testimonials are coming from. Maybe your theme or a plugin?

    Yes it could be. i could search through all the plugin script on the server and hopefully find something. The theme is a custom theme by the company who designed it. I have been through the functions.php and other php dealing with their theme but hadn’t found anything in there.

    I really appreciate your help. I know this is a pain!

    Thread Starter jfores19

    (@jfores19)

    We may be getting somewhere! its not in WP panel…but on the server i found a plugin called “comment-moderation-to-author.php” there is a read me file as well.

    Here is the entire php code:
    /*
    Plugin Name: Comment Moderation E-mail only to Author
    Plugin URI: https://status301.net/wordpress-plugins/comment-moderation-e-mail-to-post-author/
    Description: Send comment moderation notifications **only** to the posts Author, not to the site Administration address (as configured on Settings > General) any more, unless the author in question has no moderation rights. There are no options, just activate and the site admin will no longer be bothered with notifications about posts from other authors. Happy with it? Buy me a coffee… Thanks! ??
    Version: 0.4
    Author: RavanH
    Author URI: https://status301.net/
    */

    /**
    * Filters wp_notify_moderator() recipients: $emails includes only author e-mail,
    * unless the authors e-mail is missing or the author has no moderator rights.
    *
    * @since 0.4
    *
    * @param array $emails List of email addresses to notify for comment moderation.
    * @param int $comment_id Comment ID.
    * @return array
    */
    function comment_moderation_post_author_only($emails, $comment_id)
    {
    $comment = get_comment($comment_id);
    $post = get_post($comment->comment_post_ID);
    $user = get_userdata($post->post_author);

    // Return only the post author if the author can modify.
    if ( user_can($user->ID, ‘edit_comment’, $comment_id) && !empty($user->user_email) )
    return array( $user->user_email );

    return $emails;
    }

    add_filter(‘comment_moderation_recipients’, ‘comment_moderation_post_author_only’, 11, 2);

    maybe i just delete this plugin?? if you read the text file, and the top of that code, it says that this plugin overrides the email that should get sent to the site administrator as configured in settings. And i just found the plugin on the plugins page so i can try deactivating it as well. I dont see anything in that code that sends it to that one particular email address, but its got to be one of those short codes??

    Thread Starter jfores19

    (@jfores19)

    okay that did not work. i deactivated the plugin, and then went on the testimonials page and submitted a form. The site owner called me and read to me that he got it, but in the “TO” line, it still had it going to the wrong admin email, and forwarding to him.

    So i guess the next step is to delete that admin user but need to make sure i have the correct back up files to restore it if it causes issues.

    1. i couldn’t change the email on that particular admin user so i wonder if i will even be able to delete it??

    2. will i be prompted to edit user roles and author post issues after i do that or do i have to figure out how to do it manually?

    3. backup what database or files to restore if it causes something to go horrible wrong.

    You won’t be able to change the old admin email to an email address that already exists in WordPress–there can be no duplicate email addresses–which is why I suggested setting up a forwarder/alias if you go that route.

    WordPress will prompt you to reassign all content when you delete a user. You just select the user you want to reassign the content to from a drop-down of user names.

    I would use that GoDaddy tool to back up the entire WordPress database because deleting a user and changing the assignment of that user’s content changes a number of tables, not just the users table.

    Good catch on that Comment Moderation E-mail only to Author plugin. Deactivating it might not have worked because the old admin is the “author” of the testimonials submission page, and the new admin was copied because you have his address in the General -> Settings page.

    Thread Starter jfores19

    (@jfores19)

    another update: leaving that plugin deactivated, i switched that “admin” user role to nothing. i then went and resubmitted on the testimonial form and HE DID NOT RECEIVE AN EMAIL. which means that it wants to send to the the “admin”, but when the user role was set to nothing it wouldn’t. so it didn’t get forwarded to the larry_admin. It still shows up in comments for approval on WP dashboard, but didn’t get sent anywhere. I think we are making progress.

    I did back up everything…but when you say “backup the database” – I’m not sure if you mean the site, the mysql database, etc.

    Is there a way to just restore the users? or do i just restore the entire site to before i deleted the user. Im sorry but just want to make sure i do this right.

    AHHH— so thats why it wouldn’t let me change the email! So if he had another email address that is not in the site already i could switch it to that. gotcha. it wasn’t that i couldn’t change the email, it was that i was trying to change it to an email address that is already found with another user.

    What you want to back up is the MySQL WordPress database. You don’t need to back up any files when you delete a user, because all the data regarding users, content, etc. that is affected is in the MySQL database.

    No, you can’t just back up the users table in the database because other tables are affected by deleting a user.

    • This reply was modified 7 years, 7 months ago by linux4me2.
    Thread Starter jfores19

    (@jfores19)

    okay i think i got that. cool. I just backed up the mysql database yesterday, and godaddy has daily auto backups which im sure i can just restore from there if necessary.

    cant do it today but will try tomorrow and will post with any updates.

    Thanks so much

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Admin email – form submission’ is closed to new replies.