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

VitalRemains on "Insert content into specific page"

$
0
0

I've seen many posts that share this title but I want something different than them.

I am currently writing a plugin so that only logged-in users can see specific pages. I tried to achieve this by adding a simple if-block with a check to these pages if the current user is logged-in.

On my menu page, all pages are listed with a checkbox beside them. Now comes the part where I need help. I read about using add_filter or enqueue_script to insert content into a page. But it seems I can't specify on what page to use these functions without writing them directly into the pages.

So is there a way I can alter the content of a page dynamically, maybe based on the id or something?


adaldesign on "meta_query 'compare' =>'IN' not working as described in Codex"

$
0
0

I'm at a loss, trying to use what seemed like a rather textbook meta_query parameter as one of the arguments in a get_users() request.

I formatted the code (displayed below) using the instructions provided on the get_users Codex page, as well as the WP_Meta_Query Codex page referenced.
There is also a post on StackOverflow that suggests this same syntax should work just fine.

However it's not working for me. I am able to get results using the 'LIKE' compare key but that one can't process an array of values like 'IN' is supposed to. I could try to hack my way around this with an ugly foreach loop but I'd really rather keep it kosher.

Here's my code:

$user_query_args = array(
	'role'         => '',
	'meta_query' => array(
		array(
			'key' => 'guest_type',
			'value' => $gest_type // this works fine
		),
		array(
			'key' => 'wp_'. $blog_ID .'_registration_status',
			'value' => $registration_status // this works fine
		),
		array(
			'key' => 'mandatory_tracks',
			'value' => 'newphy',
			'compare' => 'IN'  //*** but this don't work ***
		)

	),
	'orderby'      => 'login',
	'fields'       => 'ID'
);

$reported_users_IDs = get_users( $user_query_args );

And just so you know I'm not crazy, this row exists in the user_meta table of the database:

82 3 mandatory_tracks a:2:{i:0;s:6:"newphy";i:1;s:9:"workforce";}

Finally, you can see my work in progress with some var_dumps here.

Any help is greatly appreciated!

GoodOmens on "Adding custom image class to only certain categories?"

$
0
0

I'm trying to add to my images "class=pinthis" to only certain post categories.

I know I should be doing this through functions.php but can't figure out where to hook.

Basically any image (except maybe if the class contains wp-smiley) in a post with a category of "Cooking" I want to append the "pinthis" to whatever is in the <img class="xxxx" ..... IE <img class="xxxx pinthis" where xxxx was whatever was there before.

All other posting categories I want to exclude from adding this class.

Thanks!

QuizToon on "proper way to add image"

$
0
0

Hi all,

I am trying to learn how to make my own plugin.

I have written a very small function which puts a back to top link at the botom of my page.

This all works and does what I expected it to do. However in the function the link is text and I would like it to be an image.

How do I get the image to upload to the media when the plugin is installed.

Any help or direction to a tutorial would be great

Many Thanks

raintoriver on "Website Hack and Protection"

$
0
0

Hi,

I'm a new user to wordpress so pardon my ignorance in a few topics. I outsourced the development of my website about a year ago and it appears it is slowly being disassembled. The site first started to have unauthorized text changes and font changes, then the whole blog page went down, now my gallery page is missing with all the photos. I don't want to blame the developer for these problems but who else would have access to the site and be able to make these changes?

When I do go in to make changes this hacking text appears ( see below )

What can i do to ensure my website is not being hacked or that my developer is milking extra work out of me. He has said he needs to rebuild the entire blog page as it is now missing. I know I made a junior mistake by not changing my password that he originally gave me; so I just did that now.

Thanks and support would be appreciated.

" viagra online finishing recommended normally. Really canada pharmacy online Doesn't and feels. Tone cialis daily After slather natural viagra automatically. Stays using to ed medications was toxins too . Without cialis samples eczema, little Instead tadalafil cialis Frieda it - and canada pharmacy online has. Have over bought perfect generic pharmacy might compliments do online pharmacy store ago subscription at this Smell But the. "

swampsparrow on "dot general25 PHP file"

$
0
0

This is a heads up.

This afternoon while cleaning up after a hack that looked very much like the one that attacked many thousands of websites (mine included) via MailPoet in July 2014 I found a file named ".general25.php" cleverly hidden in the following:

/mysite/wp-admin/css/colors/midnight/

My version of WordPress, themes, and plugins were all up to date. The file date on the server was August 25, 2014. The PHPMyAdmin PHP files were a mess, as were many of my WP files, and the database had the 1001001 user from the MailPoet exploit.

I don't know whether or not .general25 has anything thing to do with the hack or whether it's its own little gem. Just wanted to warn folks.

jimhu on "How can I tell if I messed up plugin submission?"

$
0
0

I tried submitting a plugin today and I'm not sure if it got put in the queue 0, 1, 2, or 3 times. The first two times I hit submit, I got an error on the URL to the zip file, which was pointing at github. Later in the day I tried with a different URL for the file at github and got a message that my plugin name (JSmol for Wordpress) was already taken. This seemed unlikely, and JSmol doesn't return hits when I search the plugins.

Is there a way to look at whether anything under my username is in the review queue?

Apologies if there are 3 or more copies in there.

beatnik-mag on "Website not working at all after Jetpack"

$
0
0

Hi there,

I installed jetpack to my account and then tried to add some coding into the editor - however it came up with an error and wouldn't let me make any changes - when I tried to delete/save it took me to a blank white page saying this: Parse error: syntax error, unexpected '<' in /home/content/p3pnexwpnas06_data03/51/2350951/html/wp-content/themes/trident-lite/inc/jetpack.php on line 20

Now it says the same if you try to access the site (beatnik-mag.com). I am also unable to get onto the dashboard at all now - I host through godaddy and use their wordpress launcher but now it just gives me that plain white page with error message if I even try to get onto it.

What shall I do??


Guido on "Load default text in post / page textarea field"

$
0
0

Hi,

When I create a post (product) I need to copy-paste a couple of pre-defined lines in the textarea field. These lines are the same for each product.

Is it possible to load these pre-defined lines in textarea field when creating a new post?

Guido

Turker YILDIRIM on "add_action, object property not accessible"

$
0
0

Hi,
I'm probably missing something but cant figure out. Sample code does not work as i expected.

In constructor, i change object property but when i dump it returns false. I havent dig into add_action but i assume it calls call_user_func so it should pass (?) already created object (with all assigned properties) even if not, i mean if it creates another instance, it should also go through constructor and assign 'aaa' value to $test.

To clearify, i want to get 'aaa' value from $test property while in testing method.

Thanks.

class trkr_test {
    private $test = false;

    public function __construct() {
      $this->test = 'aaa';
      add_action( 'bp_setup_nav', array($this, 'testing'), 99 );
    }

    public function testing() {
      var_dump($this); // returns object with all methods and properties but $test returns false not aaa
    }
}

function trkr_load_test() {
    $trkr_test  = new trkr_test();
}

add_action( 'plugins_loaded', 'trkr_load_test', 999 );

icy11 on "Getting user id or other info through user_register hook"

$
0
0

I'm trying to extract or get atleast the user_id upon registration using user_register hook.

add_action( 'user_register', 'display_id', 10, 1);

function display_id( $user_id ) {
echo '<script type="text/javascript">alert("Registration of user <?php echo $user_id; ?> successful");</script>';
}

But the alert doesn't even shows up.

c05338 on "Categories List into Registration Form"

$
0
0

Hello,

I'm trying to create a custom user registration form used for Educational website.

Is it possible to automatically retrieve categories of posts (custom posts) in the registration form.

The form should be:

username :
password :
first name:
last name :

optional

<category list> (courses list)

if user choose <category 1> it will automatically show related sub-categories example:

<course1>
- <sub-course-1>
- <lesson 1>
- <lesson 2>
- <sub-course-2>
- <lesson 1>
- <lesson 2>

Is there a way to do such thing into registration form?

Wuvu2 on "Problem with this function"

$
0
0

A programmer wrote the below function for me, but is no longer around to help modify.

The function looks for the author of the current page, then supplies a list of page links for pages authored by that author in a give category.

function team_resources_posts() {
    global $authordata, $post;

    $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'category_name' => 'team-resources' ) );

    $output = '<ul>';
    foreach ( $authors_posts as $authors_post ) {
        $output .= '<li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li>';
    }
    $output .= '</ul>';

    return $output;
}

It works well, and returns a list of all the pages in category 'team-resources' authored by the current page's author. It does not include other authors pages with the same category.

I would like a similar function that works by first determining the key on the current page for the custom field "Hub ID Name" and then returning a list of all the pages in the category 'team-resources' which also have the same custom field key.

For Example, if key for custom field "Hub ID Name" is "Project1" on the current page, the function would return all the pages in the category 'team-resources' which also have key "Project1". THe list of pages would not include other pages in the "team-resources" category that don't have the "Project1" key.

OR, if it would be easier - using a tag instead of a custom field would also work. So Query first for TAG "Project1" then include all the pages in the category "team-resources" that also had the tag "Project1"

Thanks for any help,
WH

atom8bit on "Updating RSS Feed"

$
0
0

This one should be pretty simple, I just want to add some extra lines to an RSS feed for a specific category
(specifically, the website hosts podcasting, so I need extra lines in both the header and the post areas of the rss2 feed.)

I saw in the codex this:

remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'acme_product_feed_rss2', 10, 1 );

function acme_product_feed_rss2( $for_comments ) {
    $rss_template = get_template_directory() . '/feeds/feed-acme_product-rss2.php';
    if( get_query_var( 'post_type' ) == 'acme_product' and file_exists( $rss_template ) )
        load_template( $rss_template );
    else
        do_feed_rss2( $for_comments ); // Call default function
}

Will this work? Where do I put it, in the theme's functions file?

Please don't recommend a plugin. I'd rather edit the theme directly if possible.

gonliSs on "Permissions problem after adding parameter to redirection"

$
0
0

Hello,

I have simple form which calls my function:

<form class="pure-form pure-form-stacked" method="POST" action="<?php echo admin_url( 'admin.php' ); ?>" >
    <fieldset>

        <input type="hidden" name="action" value="update_game_list" />
        <button type="submit" class="pure-button pure-button-primary">Update</button>
    </fieldset>
</form>

and then in function my code does simple thing and then I'd like to return one variable to this page, so I have such code at the end of function update_game_list:

wp_redirect( $_SERVER['HTTP_REFERER'] . "?inserted_games=" . $inserted_games );
		exit();

but it returns error:

You do not have sufficient permissions to access this page.

but when I delete parameter everything is ok:

wp_redirect( $_SERVER['HTTP_REFERER'] );
		exit();

Why? How to repair it?


MTWK-IDG on "jquery .position().top undefined when in wordpress"

$
0
0

I've built a content slider that works perfectly on my local computer but within wordpress it's stumbling on the following:

var begin_position = jQuery("#individual_story_wrapper").position().top;

I'm getting the follow error:
: jQuery(...).position(...) is undefined

Yet locally, the slideshow runs fine and I can see the position being changed as I animate the individual_story_wrapper up and down.

The only difference that I can see is the link to the google hosted jquery. Otherwise, everything is the same.

Ivan Privalov on "[Plugin: Events Manager] Define Event Manager categories"

Please Add Screenshots on "How to convert this snippet to taxonomies instead of categories"

$
0
0

Hi...
How would I change this snippet of code so that it outputs a list of the child taxonomies from the current custom parent taxonomy rather than categories.

This will be outside the loop in taxonomy.php

<ul>
<?php
	{ $cur_cat = get_query_var('cat');
		if ($cur_cat)
		{ $new_cats = wp_list_categories('show_option_none=&echo=false&child_of=' . $cur_cat . '&depth=1&title_li=&show_count=1&hide_empty=1');
			echo '' . $new_cats . ''; } } ?>
</ul>

AA88 on "Albums and Sub Albums"

$
0
0

Is there a way to have sub albums be listed in a parent album and only display parent albums on the main page until the user clicks the parent album they want to view? Then the sub albums will display on the other page which is linked to that parent album and when the user selects one of the sub albums it goes to projects page .
I created all the pages and it's all static design,I created a page called Projects.php,subalbum1_1.php and album1.php, and just linked them,but the problem is when I add a new category I have to make a new php page and I have to do that even for the sub albums because every album and sub album includes their posts. but is there an automatic way to do that? i read other topics related to this and they recommend plugins to use, can I do that without using plugins?
tnx

masterbip on "WPAlchemy, grouped by category but need sort by custom meta field"

$
0
0

Please … it’s been days and can’t figure it out …

WPAlchemy is simply the best … but .. here is the thing:

I got “materials” in category (taxonomies) and “family” (drop down meta field option), example:

Wall
- wood
– glass
Door
- rock
- stainless steel

I am able to group and show all the “materials” posts grouped by category, but cant figure it out to sort them by type.
I am using ’mode’ => WPALCHEMY_MODE_EXTRACT in my functions.php

This is really driving me crazy, please I really need your help, please.

This is my query to list items but cant automatically sort it by 'tipo'

<?php

	global $catalogo_mb;

	$posts = get_posts(array(
		'post_type' => 'tipo-aislacion',
		'taxonomy' => $category->taxonomy,
		'term' => $category->slug,
		'nopaging' => true,
		'post_per_page' => -1,
		'orderby' => 'meta_value',
		'meta_query' => array(array('key'=>$catalogo_mb->get_the_value('family'))),
		'meta_key' => $catalogo_mb->get_the_value('family'),
		'order' => 'ASC'
	));

	foreach($posts as $post):

	setup_postdata($post);

	$catalogo_mb->the_meta();

	$tipo = $catalogo_mb->get_the_value('family');

 ?>

Thanks really so much in advance. I know this must be easy for a lot of you guys out there, its been days without a solution. Please, thanks again !!!

Viewing all 8245 articles
Browse latest View live




Latest Images