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

storyline1 on "Where do I put this nice little script please ?"

$
0
0

Hi
I have been searching high and low to find something that will allow me to stop unregistered browsers from reading comments on posts.

There are some sophisticated plugins that will probably work but they appear overkill and expensive !

So I found the following script which apparently only allow the post author and the commentator to see the comment - it seems perfect for me but I don't know where to put it !

<em>function restrict_comments( $comments , $post_id ){

global $post;

$user = wp_get_current_user();

if($post->post_author == $user->ID){

		return $comments;

}

foreach($comments as $comment){

	if(  $comment->user_id == $user->ID || $post->post_author == $comment->user_id  ){

		if($post->post_author == $comment->user_id){

			if($comment->comment_parent > 0){

				$parent_comm = get_comment( $comment->comment_parent );

				if( $parent_comm->user_id == $user->ID ){

					$new_comments_array[] = $comment;

				}

			}else{

					$new_comments_array[] = $comment;

			}

		}else{

			$new_comments_array[] = $comment;

		}

	}

}

 return $new_comments_array; }

add_filter( 'comments_array' , 'restrict_comments' , 10, 2 );
</em>

Maybe in Functions.php or comments.php ?

Any help will be gratefully received :)

the site is http://www.thewatchwithnoname.com
It is in experimental mode at the moment !


vishalrawat on "Not able to delete users getting a error"

seagullwatcher on "User level encryption"

$
0
0

Not really sure if this is doable but,...I've set up my theme for user registrations and log ins. Users can then fill out forms and store private information. My question--is there a plug in (or otherwise configuration) which will prevent even myself (admin) from viewing a user's information? i.e. I would like to set up certain pages for users to store info which might be somewhat sensitive. Would prefer to have this capability at the page level.

Thanks for any info or re-directions.

dkad on "Unwanted Registers member on my site"

$
0
0

A lot of site owner are linking there site/Blog to my own site which is causing me sever limitation which pluging can i use to stop them from coming to my site,am using wordpress 4.1 version please can some body help me.....David

sbtypo3 on "What is sitemeta for?"

$
0
0

What methods can be used to save content here?

I'm making a plugin to let people add script tags to embed on pages and parse and list query vars to let editors set vars for each page/post.

I'm not sure abut how best to save the scripts. I want to list them so at first I thought about a custom post type, but that is a bit overkill. All I really need is a couple of fields (title and script content).

I was thinking maybe to store them in site meta as the scripts are used site wide. Is this a bad idea? If not are there any examples of how to save, and load to the site meta data? Is it as easier as editing post meta data?

Thanks.

sbtypo3 on "Best place for settings in a plugin"

$
0
0

I'm creating a plugin that adds several backend pages (it's own menu point and several subpages).

There will need to be some general settings too. Where is it best to have this page? A subpage of my plugin's main page or a subpage of the settings page.

I feel that as it is about my plugin and as I already have several subpages that I should just add another subpage to my plugin's main page rather then make people switch to the settings menu point.

Is there any best practice when it comes to placing a settings page?

tobiass on "Change Author URL"

$
0
0

I want to change the author url so that instead of showing the users login name (safety reasons) I want to show the users id.

I have this rewrite snippet, but I can't figure out how to change from username to id.

Or even better to show displayname + '-' + id (so it will become like /profile/tobias-1)

function change_author_permalinks() {
global $wp_rewrite;
$wp_rewrite->author_base = 'profile';
$wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%';
}
add_action('init','change_author_permalinks');
flush_rewrite_rules( $hard );

sidalilou on "how does the "media-button-insert" action works ?"

$
0
0

hello
I want to insert the image directly into the post right after the selection from my desktop, without passing by the "media-button-insert"
is this possible ?!


iqrakhan on "Special characters in url"

$
0
0

Hi,
I am creating a plugin, in which I need to add a special character in the URL, is there any way to do that ?
Any help will be appreciated.

Thanks

Fox_Black on "Programming an php api with wordpress functions"

$
0
0

Hello everyone!

I want to programm an plugin for my website, which should be actually an api which returns for every user his own specific data (json files in the filesystem). For user access I want to use built-in functions and functions delivered from other plugins has_user_access(user, area) for example from an other plugin. So if I want to use those wordpress functions I cant write only a .php file and place it somewhere, because the wordpress functions are not included here.

So I found 3 solutions around at the moment:

1. Somewhere I found, that you can write a .php file and include wp_load.php. But that method seems not to be recommended.

2. Next I thought about writing a custom page template, which includes only my php code and does not use page content functions like header, footer, the_content and bind that page to a subpage. So when that subpage is called for example website/myapi the php code inside the page template handles the request and gives only back the json file and I can use the wordpress functions I need inside it.

3. Use the official Wordpres Rest API Plugin. But it seems a little bit overkill for the purpose to give json files from the filesystem back since I can do the user control with existing functions and not need the authentication methods of the Rest API?

1 seems to be really bad so I will choose 2 or 3. What do you think about solution 2. Are there any disadvantages? Should I better use solution 3?

Best regards,

wpagain on "Modal Registration not submitting data"

$
0
0

I am using the SimpleModal Login plugin to streamline the registration process. It is failing though. It registers the username and email address, but none of the other fields. The other fields are supplied through the WP-Members plugin.

All the form data is serialized and I think it is being posted. I get know explicit errors. However I only see the username and email address in the user data table. The other field data never makes it into the user table.

yourinception on "Opt-in feature on the landing page"

$
0
0

Hi everyone,

I am looking for an option, where I could create a landing page with a title and a button, which would trigger a pop-up display where people can subscribe. Please find 2 examples:

http://www.littlemight.com/welcome
http://michaelhyatt.com/welcome/

It looks nothing complicated, but I have no idea how to do it. Revolution slider + mailchimp + ConvertKit don't work.

Any ideas? Please advice!

Thanks a lot,
Greg

catacaustic on "Customizer not showing control"

$
0
0

I'm having trouble trying to make a new customizer class. I've followed the tutorials as well as the Codex page, and as far as I can see I'm doing everything correctly, but I can't get my customisation section to show.

For more details, the section shows up when the customizer is loading, but it gets hidden as the section doesn't contain any controls, even though I've got them added in the code.

The code is here -> http://pastebin.com/zuzXkzQj

I've done the standard things, and from what I can see the section, setting and control are all being added to the customizer object, so I'm feeling a bit lost as to why it's not showing up.

If anyone has any ideas, I'd love to hear them!

testing10001 on "woocommerce tables"

$
0
0

I need to retrieve data from WC to my own database...
I'm very confused about where WC saves what...

This is what I figured out so far:
1.Orders stored in "wp_posts" table where the "post_type = shop_order" - However this is only the Order Title!

2.details of that order stored in "wp_postmeta" table using that "post_id" of the order.

Where does it store these things:
Shipping address
Billing address
Customer information (name, email etc...)
payment method

Thank you

mae48 on "Database not working"

$
0
0

I have created my own table on my wordpress database and created the filter search form, I also created result.php to my wordpress to output all searched products. Now, my problem is that, I dont know how to connect my database to my search filter form in wordpress.

I already created some of it but its not running..

Here's my sample code

<?php
define('WP_USE_THEMES', false);
global $wpdb;
$destination = $_POST["destination"];

echo "Welcome test" . $destination;

$sql = "SELECT * FROM rates WHERE location = '" . $destination ."';";

echo $sql;
echo "search this";

foreach ( $wpdb->get_results($sql) as $result ) {
echo "search for". $result->location;
}

?>

https://goo.gl/photos/bqqAPiAkxF5dXCxY7


mae48 on "Database not working"

$
0
0

I have created my own table on my wordpress database and created the filter search form, I also created result.php to my wordpress to output all searched products. Now, my problem is that, I dont know how to connect my database to my search filter form in wordpress.

I already created some of it but its not running..

Here's my sample code

<?php
define('WP_USE_THEMES', false);
global $wpdb;
$destination = $_POST["destination"];

echo "Welcome test" . $destination;

$sql = "SELECT * FROM rates WHERE location = '" . $destination ."';";

echo $sql;
echo "search this";

foreach ( $wpdb->get_results($sql) as $result ) {
echo "search for". $result->location;
}

?>

https://goo.gl/photos/bqqAPiAkxF5dXCxY7

totoparasca on "Redirect page in WooCommerce"

$
0
0

Hi,

I would like to redirect the user to an affiliate page when clicking on the product. I mean when a user see a product in a specific category and clicks on it to be redirected right away without needed to go through the /product/XXX page and then click on "buy" or what ever.

Thanks!

mihaela02 on "radio buttons"

$
0
0

How I can determine what radio button is checked before form submision?
I have a form with many fields and I want o show some fields if a radio buttton is checked and other fields if the other radio button is checked.
If you can tell me step by step what I must do. Thanks.

vivekghatala93 on "Wordpress functions not defined error when user not logged in."

$
0
0

I am customizing the wordpress theme and have developed a custom sign up page for user in my website. It works perfectly until the user clicks on Register button after completeting the form which redirects to homepage but the problem arises here where the wordpress php functions to get header seems undefined..

I havent logged in as a user during the whole process.

Please help. Thank you.

Philip Ingram on "Customizer - detect post-type?"

$
0
0

When building options for the customizer it would seem optimal to only provide those options if the given preview page applies to those options.

For example, if one writes a plugin to add some customizer options that only apply to single pages, we wouldn't want to confuse folks by presenting those options when viewing a blog or archive page. Same thing goes for woocommerce, I wouldn't want to show woocommerce options unless I am on a shop page and alternatively not show those options if not on a shop page.

Since navigating pages in the customizer produces a full refresh it would seem logical to be able to detect the post type and load options dynamically.

Is this even possible in the customizer yet? Are we forced to show all customizer options all the time regardless of the page visited?

Viewing all 8245 articles
Browse latest View live


Latest Images