Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

oudrib on "Run function after save page add_action('save_post','my_function') doesn't "

$
0
0

Hello,
I can't find any solution my problem,i am using this add_action('save_post','my_function')but no result,and i want to add item to custom menu (with link domain/#page-title) directly after saving page and rename the link after any change on the page title also removing item from the menu after deleting page.
thank you so much


Digict on "Woocommerce variables - Reseller Ratings"

$
0
0

I'm trying to integrate the Reseller Ratings code into my Woocommerce "Thank you" page.

The code requires that the email and order number be passed to the script, but nothing I enter works.

Here's an example of the code:

<script type="text/javascript">
var _rrES = {
    seller_id: XXXXXXX,
    email: "customer@home.com",
    invoice: "INVOICE NUMBER"};
(function() {
    var s=document.createElement('script');s.type='text/javascript';s.async=true;
    s.src="https://www.resellerratings.com/popup/include/popup.js";var ss=document.getElementsByTagName('script')[0];
    ss.parentNode.insertBefore(s,ss);
})();
</script>

I've tried various things but this is my latest attempt which does not work either.

<script type="text/javascript">
var _rrES = {
    seller_id: XXXXXXXX,
    email: "<?php echo $current_user->user_email; ?>",
    invoice: "<?php echo $order->get_order_number(); ?>"};
(function() {
    var s=document.createElement('script');s.type='text/javascript';s.async=true;
    s.src="https://www.resellerratings.com/popup/include/popup.js";var ss=document.getElementsByTagName('script')[0];
    ss.parentNode.insertBefore(s,ss);
})();
</script>

Can anyone help me get the right variables into that code please!

igalmalk on "First line of all PHP files modified hack - solution"

$
0
0

Hi,

I am not sure how to block this hack, but as a workaround
I wrote a solution which would restore your files even if you dont have any backup,
the below script catches all infected php files on your server, backup them (with it original path),restoring them into it orig state, and also write a summary file with the result
It works great for me (about 21000~ php files scanned and fix in 7min)
In order to use it copy the below code into file on your home directory
name the file php_fix.sh
make it executable by typing
chmod +x php_fix.sh
and run it:
./php_fix.sh y

You may consider add it to your crontab job to run automatically every day.

enjoy

#!/bin/bash

infected_files=0
fixed_files=0
DATE=date +"%d-%m-%y %T"
find . -name "*.php" |grep -v 2fix > php_files.dat

php_files=cat php_files.dat |wc -l

if [ ! ls 2fix ]
then
mkdir 2fix
fi

while read file_name
do
if [[ head -1 $file_name |grep GLOBALS ]]
then
if [[ $1 == "y" ]]
then
fixed_string=head -1 $file_name |grep GLOBALS | awk -F"?>" '{print $3}'
cp --parents $file_name 2fix/
sed -i "1s/.*/$fixed_string/" $file_name
#sed -i "1s/.*/\<\?php/" $file_name
#sed -i '1d' $file_namea
let fixed_files=$fixed_files+1
else
let infected_files=$infected_files+1
fi
fi
done < php_files.dat
echo $DATE, "Scannded files:" $php_files, "Fixed files:" $fixed_files, "Infected: " $infected_files >> fixed_files.dat
exit

Dugs on "Welcome Message (is_user_logged_in)"

$
0
0

Hi

I added a function to my child theme which is a modified version of this: http://codex.wordpress.org/Function_Reference/is_user_logged_in

It adds a welcome message, avatar and various links to subscribers but a different view for non-subscribers. This works well and adds the message just below the page title of pages and posts. I have noticed though that its also adding this message to the RSS feed which breaks it and also to certain widgets (ones which show random posts or featured images).

I am trying to figure out a way to remove it from widgets and the rss feed and just wondering if anyone has any ideas.

Thanks

add_action( 'loop_start', 'personal_message_when_logged_in' );

function personal_message_when_logged_in() {

if ( is_user_logged_in() ) :

global $current_user;
get_currentuserinfo();
    $current_user = wp_get_current_user();

    echo '<div class=welcome-mess><p style="text-align: center;">'; echo get_wp_user_avatar($current_user->ID, 96); echo 'Member: ' .'<strong>' . $current_user->user_login . '</strong>'. "<br>"; echo '<a href="https://www.dugswelcome.com/members/">News</a> | <a href="https://www.dugswelcome.com/your-dugs-profile/">Profile</a> | <a href="https://www.dugswelcome.com/postcodesearch/">Search</a> | <a href="https://www.dugswelcome.com/discount-codes/">Discounts</a> | <a href="https://www.dugswelcome.com/dogfriendly/dog-friendly-maps/">Maps</a> | <a href="https://www.dugswelcome.com/printable-pdf-guides/">Downloads</a> | <a href="https://www.dugswelcome.com/bookmarks/">Bookmarks</a></p><hr /></div>';

else :
        echo '<div class=welcome-nonmembers><p style="text-align: right;"><a href="https://www.dugswelcome.com/dug-shop/">Online Shop</a> | <a href="https://www.dugswelcome.com/dugs-account-sign-up/">Membership</a> | <a href="https://www.dugswelcome.com/wp-login.php?action=lostpassword" rel="nofollow">Lost Password?</a></p><hr /></div>';

    endif;
}

adriandoyle60 on "Hacked by Sh0uT0u7"

$
0
0

A number of my web sites have been hacked - all seems OK until you add a new page, then you get a hack screen.

Also, any link to a non existent page brings up the hack screen.

There was a file inserted, g.php, which I deleted but the hack remains.

To see what I mean, look at http://www.adriandoyle.co.uk/foo

I have looked through all the wordpress directories and can't find any dodgy files.

Has anyone come across this?

fschirinzi on "Change widgets.php"

$
0
0

Hello community

I have a problem.
I want to customize the widgets.php page.

Idea:
Each user has to have an own Dashboard with own widgets.

First try:
Copy the widgets.php file into my theme direcotry, add a new menu item that render the php file and change all links into the widgets.php so that it should work... with no success. Isn't it possible or did I something wrong?

Second try:
Add a hook, so that 'Inactive Sidebar (not used)' and 'Inactive Widgets' will be not shown in the edit widget area. But I can't find the appropriate hook/filter/action

Thank you,
Francesco Schirinzi

cico82 on "Password protection from read more. I'd like to see excerpt of post"

$
0
0

Hi
anybody have some suggestion? plugins? php?
I want to protect some post but I'd like you could see the preview of the password protected post.
Thanks

lokust on "Custom post query"

$
0
0

Hi, I have a custom post type to show some products.
I need to sort those products on the archive index page by name.
However I need to exclude a word "XYZ" from the ordering:

Product names are as follows and in the order they should appear:

XYZ Product a
XYZ Product b
Product c

Is there a way to do omit "XYZ" from the name ordering in the post query?


marathikavitablog on "adding excerpt or content in rss title"

$
0
0

I want to add rss excerpt to post title,any help?

spasarok on "List of Default Customizer Controls"

$
0
0

I'm working on a variant of the Twenty Eleven theme and am currently tweaking the Customizer. I'd like to move the Header Text Color control from the Colors section to the Site Title & Tagline section.

I know that I can do this with the Link Colors control using the code:

$wp_customize->get_control( 'link_color'  )->section   = 'title_tagline';

Here link_color indicates the control. What do I have to use to indicate the Header Text Color control? Is there a reference list of all the default controls?

magoz on "Define the category used in get_next_post"

$
0
0

Hi,
I have posts that have different categories. Some of them share same categories in addition of having different ones.
Example:
Post 1 has Categoy 1 and Category 2
Post 2 has Category 2 and Category 3
Post 3 has Category 1 and Category 3

I need to be able to choose which category is going to be used in next /previous posts.
Example:
For Post 1 use Category 1 only. (which will reach post 3 as next post, not Post 2).

I checked the function reference in WordPress codex and it can't be done with the parameters of /get next post. You can only exclude certain categories, use the current category or specify a taxonomy.
I need to be able to specify the category of the next / previous post by myself.

My idea is to get the category current printed in the url.
I'm using the following code, where:
$categoryslug is the category slug printed in the url that I want to use to tell WordPress which category will be used in next / previous posts.
Code:

<?php $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>
	<?php if (false !== strpos($url,'?c')) : ?>
		<div id="nav-portfolio">
			<?php
			$categoryurl = explode('/', $url);
			$categoryslug = str_replace("?c=","",$curl);
			?>
			<div class="prev">
				<?php
				$prev_post = get_previous_post();
				if (!empty( $prev_post )): ?>
				<a href="<?php echo get_permalink( $prev_post->ID ); ?><?php echo $categoryurl[sizeof($categoryurl)-2];?>/"><?php echo $prev_post->post_title; ?></a>
			<?php endif; ?>
		</div>
		<div class="next">
			<?php
			$next_post = get_next_post();
			if (!empty( $next_post )): ?>
			<a href="<?php echo get_permalink( $next_post->ID ); ?>
				<?php echo $categoryurl[sizeof($categoryurl)-2];?>/"><?php echo $next_post->post_title; ?></a>
			<?php endif; ?>
		</div>
	</div>
	<?php endif; ?>

Getting the category slug from the URL works well, but I need a way to tell WordPress to use only this category. Maybe working over this part?
$next_post = get_next_post();

Any idea of how to call only a specific category in nex / prev post function?

You can check the website I'm working on here:
http://magoz.is/_beta/follow-your-dreams/?c=personal/

Thank you very much in advance folks!

albert85y on "Issues with Structured Data in Webmaster tools"

$
0
0

Hi there!

To begin with, after a week of researching, reading through lots of different solutions..I simply gave up.

The problem (I've realised this has been affecting quite few WordPress sites), are the errors as per example below:

Error: Missing required field "entry-title".
Error: Missing required field "updated".
Error: Missing required hCard "author".

Google rich snippets tool shows over 100 of these errors on various pages on our site, I couldn't find a working solution anywhere.

We use WordPress theme called Kickstart, which I guess made things complicated as is slightly different. All solutions I've found where for more common themes :(

Any ideas please?

Many thanks!

valgosais on "Hide featured image to posts in a specific category"

$
0
0

In twenty fourteen how do I hide the featured image (which I need for sharing options) of specific category post?

Any help?

mike62 on "Capturing an email address from the front-end registration form"

$
0
0

I have a site using WooCommerce. I've added a checkbox to the registration form here, for subscribing to a newsletter:
https://www.hilarydruxman.com/my-account/

Is it possible, when the form is submitted to check to see if that newsletter checkbox is selected, and if it is, send the email address to a 3rd-party service? I'm using Sendy.

Thanks!

Here's the code I'm using to add the checkbox (in functions.php):

add_filter( 'register_form', 'adding_custom_registration_fields' );
function adding_custom_registration_fields( ) {
	echo '<div class="form-row form-row-wide"><label for="reg_subscribe"><input type="checkbox" name="reg_subscribe" id="reg_subscribe" value="'.esc_attr($_POST['is_subscribed']).'" />Subscribe to the newsletter</label></div>';
}

jaaway on "Rerouting to lily666.com on mobile devices"

$
0
0

Our wordpress site is being rerouted to a site called lily666.com when trying to reach it on a mobile device. Our site was hacked a few weeks ago and we have been able to recover and repair most if the damaged files and data. However the mobile reroute still remains. We have tried rewriting the .htaccess files and restoring to an older database file that was known to be clean and it is still happening. Can someone please provide some ideas as to how we can get this threat eliminated.

Thanks to everyone

AB


Void5150 on "Pop up box (with fade)"

$
0
0

Hello,

I would like to make a feature I had in mind.

When the user clicks a specified link, a pop up box will appear and the background will fade. The box will contain a lot of information, so maybe it will embed a page or a post? I do not want the box to look like a typical pop up, so no URL or traditional exit (X) button. The user will click outside of the box for it to close.

Any ideas on how to create this? If not, can you please point me in the right direction?

Thanks!

The Barefoot Bookworm on "WP pingbacks exploited for DDoS attacks?"

$
0
0

A blogger recently got attacked by a hacker who used pingbacks to try and overload his servers. Here's the entire post about it: http://trilema.com/2014/o-hai-let-me-wanna-be/

Of particular note in this post is the message displayed only to WP users whose blogs were used in the attack:

You are seeing this because your blog was recently used as part of a DDOS attack against Trilema.

The way this works is that the attacker sends pingbacks to a long list of blogs. The blogs in question then load the indicated url to try and verify if the pingback is legitimate (ie, if the url of the pinged blog actually appears on page), resulting in massive traffic spikes for the victim.

This works because WordPress pingbacks are poorly implemented. A more solid implementation would verify if the pingback originates from the same IP as the site that supposedly sent it, and discard the request if there's a mismatch. The current implementation allows pingbacks to be sent by any arbitrary IP, and so allow a malicious user yet another DDOS vector.

Please do your part by fixing your pingbacks implementation. The easiest way would be to open the file xmlrpc.php found in the root directory of your blog installtion, and modify the part that says

// Let's check the remote site

		$linea = wp_remote_fopen( $pagelinkedfrom );

To instead say

// Let's check the remote site

    // First, make sure we're not being used for DDoS!

    if (gethostbyname(parse_url($pagelinkedfrom, PHP_URL_HOST))
      <> $_SERVER['REMOTE_ADDR'])
      die ("Sorry, you will have to send this from your blog's IP.");

    		$linea = wp_remote_fopen( $pagelinkedfrom );

This checks that the IP of the domain you think you've been pinged by and the IP of the client informing you were pinged match, and dies if they don't - rendering this particular DDoS avenue inoperable while maintaining all the pingback functionality you could possibily want.

Thanks for being part of the solution!

Wordpress community, sound off? Does this vulnerability really exist, and if so, is it possible to fix it in the core? What do you think of the proposed solution? Could there be a possible downside to it?

I'm not a programmer and I had never heard about such a vulnerability before, but since my blog was one of the blogs implicated (the list is almost 300 MB, have asked the blogger to check it for me) I'm obviously quite concerned and I wonder if other people have heard of or experienced such attacks before.

davepmb on "http://ftp.sitename.com redirects to different site - BLACKJACK!!! HELP!"

$
0
0

Hi,

Looking through what has been indexed so far I noticed top of the page was http://ftp.sitename.com and when I click on this site it goes to a blackjack 21 site!!!

I have strict rules in place but can only assume SQL injection???
I have set a redirect for the dns record for ftp to point to no where but this allows me to not access my website through ftp any more.

How do I fix this problem and where do I start troubleshooting please as I do not want my ftp to point to no where for ever!

Thanks

frank.uray on "grid/list on wordpress page"

$
0
0

Hi all

I am very new in using wordpress, sorry for maybe stupid question.
For example: I have a menu which calles the page cars.
In the page cars I like to have a list (or grid) of cars,
means each row needs to have a column with some text and one
with an image. when clicking a row it should jump to a image
gallery with all the images of this selected car.

What is the best (modern) plugin to use for something like that ?
Or can it be done without a plugin ?

Thanks for any help !
Frank

ankytt on "Mobile Number Field in Sign up Form + SMS api"

$
0
0

Hello Guys,

I am trying to create a sign-up form with mobile number. I was able to add the text field using this tutorial:
http://codex.wordpress.org/Customizing_the_Registration_Form

Now, I want to customize the field so that it accepts only 10 digit number. Users should be able to modify this mobile number later on their profile page. Also, I am using a SMS API. So, i want to send a welcome text to this mobile number when user successfully register and when he makes a request to reset the password.

How should i do this? My SMS api is a simple HTTP api.

Thanks,
Ankit A.

Viewing all 8245 articles
Browse latest View live




Latest Images