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

wwwolf on "Restrict user registration to emails on a single domain"

$
0
0

I need to allow user registrations only for those with email addresses on a single domain. I have tested multiple regular expressions and this one works well in a regex sandbox environment, but as soon as I put it into my functions.php file, it simply rejects all registrations - even email addresses on the correct domain (with the error message below, so it's definitely this conditional that's breaking it). Am I:
a) actually doing something stupid in the regex, even tho the online regex testers say it's doing what I want?
b) using a regex syntax that WordPress doesn't support?
c) screwing up something in the rest of the function?
d) misunderstanding the codex, and it's not as simple as just adding this to functions.php?

add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 );
    function myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) {

        if (!preg_match('( |^)[^ ]+@mydomain\.co\.uk( |$)', $user_email )) {
        $errors->add( 'invalid_email', __( 'ERROR: Only valid "mydomain" email address is allowed.' ));
        $user_email = '';
    	}

        return $errors;
    }

I've been staring at this so long now, it could be blindingly obvious and I wouldn't see it!

Many thanks!


harbaryhormi on "Website Homepage Error"

$
0
0

hello,

i am a new wordpress user and i just finished my first website for a firm, and after about 3 days i got this error on the home page of the site...

Uname:
User:
Php:
Hdd:
Cwd: [exploit-db.com]
1519 ( minefree ) Group: 1518 ( ? )
5.5.37 Safe mode: OFF [ phpinfo ] Datetime: 2016-08-15 05:30:56
3660.86 GB Free: 3376.29 GB (92%)
/home/minefree/public_html/ drwxr-xr-x [ home ]

Server IP:
96.30.32.212
Client IP:
197.211.58.28
[ Sec. Info ] [ Files ] [ Console ] [ Sql ] [ Php ] [ String tools ] [ Bruteforce ] [ Network ] [ Self remove ]
File manager
Name Size Modify Owner/Group Permissions Actions

am confused and don't know what else to do.

thanks.

janbrokes on "NExt and previous post links with #anchor"

$
0
0

HEllo this is part of code of previous link

$previous_post_link = get_previous_post_link( '%link', '<span class="meta-nav">' . esc_html( _x( '&larr;', 'Previous post link', 'et_builder' ) ) . '</span> ' . $previous_link_text, $in_same_term, '', $current_taxonomy );

I need to add at the end of url #anchor

so that link of previous post looks like http://www.domain.com/prev-post1/#anchor

Thansk in advance

guylancaster on "responsive input tables"

$
0
0

I want to code a responsive checkbox table in a form.

I coded it by reading from a database to a php variable, and generating the table of checkboxes with javascript, and regenerating it from the php variable on resize.

So far so good....

But then my boss tried to click a few check boxes on his ipad and swiveled it round, changing the resolution, refreshing, but losing the added check box values (as it read from the initial php variable).

Maybe I should save the db values to a session, update the screen from the session, and on change of any checkbox, update the session (javascript or ajax php?), and then read the session back on resize.

Is this the best way to do this?

Ethan Jinks O'Sullivan on ""Undefined index" error when saving empty array with checkboxes"

$
0
0

I have WP_DEBUG mode on my local WordPress install for a plugin I am developing.

In my plugin settings page, I have a list of checkboxes that store the value into an array. While the functions work as expected, whenever I uncheck all of the checkboxes and save those changes I get the Notice: Undefined index: remove_field (line 19) error showing up only when I have debug mode on. Below is the source:

https://github.com/factmaven/disable-blogging/blob/dev/includes/settings-profile.php

From doing research online for a similar error, I see that the recommendation is to wrap $_POST['remove_field'] with an isset. However, this does not store the values form the checkboxes in the plugin settings.

As mentioned above, this error shows up only when all of the checkboxes are unchecked and saved. It looks like there is an issue when saving empty values in the array. Although the plugin settings works as expected, I'd like to fix this.

allwaysontopp on "include adbanner from my other blog, remotely"

$
0
0

Hello there.

I would like to put an ad banner on wpblog1.com and include that on wpblog2.com and wpblog3.com

When it's time to change the ad banner, I'll do that on just wpblog1.com and it shows up on the other blogs too.

How can I include that in a safe way?

http://wpblog1.com/ad01.php
or:
http://wpblog1.com/ad01.html
or:
http://wpblog1.com/ad01.asp
doesn't matter for me, but maybe for the security)

My Wordpress blogs are hosted on Cent OS on Hostgator's Reseller Hosting.

Thanks.

wynandoosen on "Suppress view of label if user logged out"

$
0
0

Hi, I am going crazy with this problem so I hope somebody can help.

http://wattev2buy.com/product/best-ev-in-china/

There are three meta fields in woo commerce that I don't want to show to logged out users. The source of the metadata, however, is from WP Front End Pro and they advised the following

http://docs.wedevs.com/docs/wp-user-frontend-pro/tutorials/showing-meta-fields-in-frontend/

My poor effort is:

<div class="<?php if ( is_user_logged_in() ) echo "logged-in"; else echo "not-logged-in"; ?>">
<?php echo get_post_meta( $post->ID, '_email', true ); ?>
<?php echo get_post_meta( $post->ID, '_regular_price', true ); ?>

And then in style css

.not-logged-in .get_post_meta( $post->ID, _email ) {
display: none;
}
.not-logged-in .get_post_meta( $post->ID,_regular_price ) {
display: none;
}

And then there is a field I don't want to show to logged in or out users - the _gallery_images at bottom.

DurdenBlog on "I can not retrieve a specific portion of an HTML file (blog post) with AJAX"

$
0
0

Hello to the WordPress community!

I have a small problem with a feature that I'm trying to implement on my site. I want when I click on an excerpt from a blog post on my homepage that the content of the article (single.php) opens in a modal window.

I use jQuery and Ajax to do that and it works really well except that Ajax fetches me the entire contents of single.php file (ie the header with scripts, styles, doctype, footer, etc.). I would just like to get the div (#PostContainer) that includes the title of the article and the content.

You will probably tell me to just delete my header and footer of the single.php file, but this is not possible because it is important to keep intact my file to be able to access from the address of the blog post (www.mydomainname.com/blog-post1).

Someone would have any idea ?

Thank you so so much for your time !

Here are my code :

HTML :
<a class="hs-inner-click modal" data-content="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>" href="<?php the_permalink(); ?>">

CSS :

.modal-window {
  position: fixed;
  left: 50%;
  top: 50px;
  width: 720px;
  background-color: #fff;
  transform: translate(-50%, 0);
  z-index: 11;
}
.modal-shade {
  position: fixed;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, .7);
  z-index: 10;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

JQUERY & AJAX :

(function($) {

	$.fn.modal = function (opt) {

		var settings, createModal, closeModal, body;

		settings = $.extend({
			'modal': 'jquery-modal',
			'close': 'jquery-modal-close',
			'closeText':'',
			'shade': 'jquery-modal-shade'
		}, opt);

		body = $('body');

		closeModal = function(modal, shade) {
			modal.remove();
			shade.remove();
		};

		createModal = function(data) {
			var shade, close, modal;

			shade =$('<div />', {
				class: settings.shade
			}).on('click', function() {
				closeModal(modal, shade);
			});

			close =$('<a />', {
				text: settings.closeText,
				class: settings.close,
				href: '#'
			}).on('click', function(e) {
				closeModal(modal, shade);
				e.preventDefault();
			});

			modal =$('<div />', {
				html: data,
				class: settings.modal
			}).append(close);

			body.prepend(shade, modal);
		};

		this.on('click', function(e) {
			var self =$(this);

			$.ajax({
				url:self.data('content'),
				type: 'get',
				cache: false,
			}).done(function(data) {
				createModal(data);
			}).error(function() {
				createModal('There is a mistake');
			});
		e.preventDefault();
		});

	};

})(jQuery);

deuts on "Limit get_terms within a period"

$
0
0

I'm trying to use get_terms in order to display the top 10 terms in my custom taxonomy in the sidebar. However, I'm just wondering if there's any parameter I can use in order to limit the top 10 terms used in posts in a period, like for example in the last 30 days?

deuts on "Custom Taxonomies Widget"

$
0
0

I'm looking for a hack to display custom taxonomies in the sidebar. I know there are quite a few plugins available for such but I was hoping to display only the top terms used for a certain taxonomy in the last say 90 days. Any help would be appreciated.

searay on "Display Google Street View instead of thumbnail on post preview"

$
0
0

Hello,

I want to display small live google street view image instead of a post thumbnail.

Here is the code for displaying thumbnail:

<figure>
            <a href="<?php the_permalink(); ?>">
                <?php
               global $post;

                if( has_post_thumbnail( $post->ID )) {
              // get_template_part('property-details/map-snippet');
                   the_post_thumbnail( 'property-thumb-image' );
                } else {
                    inspiry_image_placeholder( 'property-thumb-image' );
                }

                ?>
            </a>

            <?php display_figcaption( $post->ID ); ?>

        </figure>

The google street view on my theme is called by get_template_part function and when Im trying to replace the part for thumbnail with this function it only shows up the street view on one out of four posts in the search results. Whatever I put there instead the thumbnail it works fine, displaying on all four posts, whereas street view not.

here is the snapshot As you can see it is not even in the proper place, showing address for the bottom right property. What do I do wrong here? Can someone help? Thanks

Chris Whiteley on "Increase Image Caption Limits"

$
0
0

I have a case where images have avery detailed captions. Some of which have 750+ characters. It appears that WordPress cuts off the captions at a certain point.

Is there a way to increase the number characters allowed in a caption?

octacian on "Creating a Table with WP_List_Table"

$
0
0

I'm trying to create a plugin that makes managing shortcodes much like managing posts, except (hopefully) much more intuitive. I have almost everything setup: admin page, general hooks (activation...), and a few other things. The issue I'm having, is that I can't figure out how to display the entries from the database as a HTML table like with plugins. I've tried several guides, but can't figure it out.

I also need to design the page for editing or creating new shortcodes, but this, obviously, has to come first.

ramhegde on "How save is wordpress from SQL Injection for hacking"

$
0
0

Hi,
Am being using wordpress for 1years now,
from months now i Find constant attack of hackers may be they would be using SQL injection for hacking my website

how safe is word press against SQL injection is their any chance of vulnerable of my word press version

Please help me out if wordpress is 100% safe against Sql injection, then i shall check out other safety measure to my site from hackers

Angelo Rocha on "Remove caps"

$
0
0

Is possible remove "upgrade_core" cap from specific administrator?
I try:

function admin_security() {
	$adminID   = get_current_user_id();
	$userCap = new WP_User($adminID);
	if ( $adminID != 1 ) {
		$userCap->remove_cap( 'update_core' );
		$userCap->remove_cap( 'update_plugins' );
		$userCap->remove_cap( 'update_themes' );
		$userCap->remove_cap( 'install_plugins' );
		$userCap->remove_cap( 'install_themes' );
		$userCap->remove_cap( 'delete_themes' );
		$userCap->remove_cap( 'delete_plugins' );
		$userCap->remove_cap( 'edit_plugins' );
		$userCap->remove_cap( 'edit_themes' );
		$userCap->remove_cap( 'switch_themes' );
		$userCap->remove_cap( 'remove_users' );
		$userCap->remove_cap( 'activate_plugins' );
	}
} add_action( 'admin_init', 'admin_security' );

In this situation i'm trying to keep certain caps only for administrator ID 1.
But not success =(

Note: I have good reasons to need to do so.


madge7356 on "how to target a specific page"

$
0
0

I want to change the css in my theme for a specific page....
so for example I want to change the wrapper of my About page.
I'm thinking this in my css would work...
#wrapper.page-id-11{
}
but the problem is I want to be able to update my page sometimes and every time I do one little update, it changes my page id so i would have to by hand change it in the css.
Is there a better way of doing this??
Thank you!

markazi on "Comment Problem"

$
0
0

Hi

My website is new But:
I have 300 pending comments and 506 approved comments which all of them
are spam.(I'm sure all of them are spam).
First time i approve one user and now i know that user send these comments.
I remove all 300 pending comment and also remove that user; Then install
Akismet and also install delete spam comments plugins. After that close comment in settings-->Discussion.
Now 506 approved comments increase every day(Now is 643 comments) and when i click on approved comments in setting i can't see any comment.
I think they can hack my wordpress website. I'm right?
Anyone can help?

Thanks & Best Regards

laken4921 on "a sql query with a semicolon problem"

$
0
0

I have this php script that generate an sql query. However, it needs a semicolon inside the sql statement and because of that, the sql query doesn't work.
The problem is that, the value bm_shopping_cart.php;bm_categories.php doesn't stored in the database that suppose to be inserted by that query. When I removed;bm_categories.php the value bm_shopping_cart.php is inserted on the database. So the problem resides on having the semicolon. I also tried using \ but the problem still there. I really need the semicolon included on the value. Any ideas?

VALUES ('Installed Modules', 'MODULE_BOXES_INSTALLED', 'bm_shopping_cart.php;bm_categories.php', 'This is automatically updated. No need to edit.', '6', '0', now())

It is included in this function.

function insert_configuration6_table($table_name9, $type) {
     global $wpdb;

     if (!empty ($wpdb->charset))
     $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     if (!empty ($wpdb->collate))
     $charset_collate .= " COLLATE {$wpdb->collate}";

    $sql = "INSERT INTO {$table_name9} (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_BOXES_INSTALLED', 'bm_shopping_cart.php;bm_categories.php', 'This is automatically updated. No need to edit.', '6', '0', now()),('Installed Template Block Groups', 'TEMPLATE_BLOCK_GROUPS', 'boxes', 'This is automatically updated. No need to edit.', '6', '0', now());";

     require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     dbDelta($sql);

I have searched a lot for this however, I can't find a solution that work.
How can I make an sql query that includes a semicolon in the values? or do you have any solution to this or a dbdelta alternative??

[Moderator note: Please wrap code in the backtick character or use the code button.]

laken4921 on "Server Error"

$
0
0

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator,and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an Error Document to handle the request.
Only thing I change was in Settings , General – Word Press address (URL) and Site address (URL) I have now received this error.
Could you please assist to correct this error thank you?

qadirnakia789456 on "Set WordPress Post Expiration"

$
0
0

Dear All,
I was wondering if there is any possibility to set an expiration date for each post.
Suppose you add a job on a website then job's closing date is 1 month later. Instead I, going to close that post, it would be perfect if that date the post expired by it.
Thanks for your help and ideas.

Viewing all 8245 articles
Browse latest View live




Latest Images