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

creativewild on "Make plugin options available in front-end for registered users"

0
0

Hi all,

I have tried to search but i was unable to find or i used the wrong keywords for that.

Here's my Question:

Is there a way to make the backend option os a plugin to be available in the front-end site so the users don't have to go to wp-admin to add/change things.
The plugin in question is http://wordpress.org/plugins/gw2-chars/, I was able to change the permission to allow the registered uses to see it (instead of the default that just allowed for editor or above to use it).

Any help would be great appreciated.

Thanks


Supa Hero on "Require email activation link for New Users and also BAN temporary emails ?"

0
0

Hi,

Since my blog will allow public registrations via the default url (wp-login.php?action=register)

I registered to my site with a temp username & another gmail address. WordPress didn't even ask for email activation? It just emailed the password. Nothing else?

IPB Forums (on my subdomain), require validation, and has Captcha to stop spam registrations. Also IPB allows for BANNING of temporary email addresses.

So basically, are there any functions for functions.php that i can add to do this:
- Verify user emails
- Require Captcha (to stop automated signups)
- BAN temporary email domains

I know i said "functions" rather than a plugin, i feel like i don't want to have a million plugins & watch the server crawl to a halt (most tech site advise on using less plugins anyway)

Thanks for reading :)

Supa Hero on "Check specific "text" from a Custom Field and output it, or else do something.."

0
0

Hi,
So my blog is based on music news and such....

On my custom fields for embedding media. I only allow 2 sources.
- Either Youtube OR a SoundCloud URL

So, i'd like a simple php code that can do this:

[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

<?php
Check post meta (get_post_meta($post->ID, 'my_url_media', true);)
?>
<?php if any meta value exist; (continue)
If post meta contains this string "http://www.youtube";
echo '
<div id="JWPlayer"></div>
<script>
    jwplayer("JWPLayer").setup({
      file: "'.POST META HERE (YOUTUBE).'",
      width: "100%",
      height: 30
    });
</script>
';
}
ELSE
{
If post meta contains  "http://soundcloud"
echo '<iframe src=" POST META HERE (soundcloud)" class="somerandomCSSClass"></iframe>'
?>

If there is no meta value, then do nothing at all.

As you can see, i'm a complete php novice, but at least i know how i'd like the function to work.

So PHP & WP gurus, what do you think ?

Thanks for reading

joshlevinson on "Correct User Login Redirect Action/Filter"

0
0

The popular membership plugin 's2Member' uses the wp_login action hook to wp_redirect a logged in user to where s2 deems appropriate. This causes a conflict with other plugins, in that other plugins may rely on the WP_User object being returned from the wp_signon function, which will not happen if the user is redirected by the wp_login hook.

What is the correct way to redirect a newly logged in user? I would assume the filter login_redirect, no? The problem with that is that s2Member uses remove_all_filters on that very same filter...

anoopd on "Change default Url of Category-slug"

0
0

Hi
Is it possible to change the default url of a category-{slug} page from http://www.mysite.com/category/{slug} to http://www.mysite.com/category/{slug}/{year} where 'year' is the year of latest post in that category .?

I have already rewritten rules so that the content is accessible
ie; category/{slug}/{year} gives the posts in that category for the particular year. The problem now is to access the page( list of archives of latest year) i have to add a custom menu link with hardcoded url. Is there any other way to do this

with regards

5ulo on "Multiple category sets"

0
0

I'm trying to make to work something like this:
Category set 1:
+ Meat
+ Vegetables
+ All (Meat & Vegetables)

Category set 2:
+ Recipes
+ Info
+ blah blab bla
+ some other stuff

It's not hard to have two custom menus but when I select Meat and then I select Recipes, it will show up also articles from Vegetables. How can be done that when I choose Meat and then Recipes, that will show only Meat Recipes? How to tie these two sets? Thanks for any advice

kazgrafix on "Need to add the User Role in Support ticket admin page"

0
0

Currently within the admin of the support ticket plugin I am using it shows a list of tickets that have been submitted.

What I'm needing is to have the user role next to the user nicename i.e. nicename/user_role

I think I have found the piece of code I need to amend which is :

$output .= '<table class="widefat" style="width:100%"><thead><tr><th>'.__('Ticket', 'wpsc-support-tickets').'</th><th>'.__('Status', 'wpsc-support-tickets').'</th><th>'.__('User', 'wpsc-support-tickets').'</th><th>'.__('Last Reply', 'wpsc-support-tickets').'</th></tr></thead><tbody>';
                            foreach($results as $result) {
                                    if($result['user_id']!=0) {
                                        @$user=get_userdata($result['user_id']);
                                        $theusersname = $user->user_nicename;
                                    } else {
                                        $user = false; // Guest
                                        $theusersname = __('Guest', 'wpsc-support-tickets');
                                    }
									if(trim($result['last_staff_reply'])=='') {
										$last_staff_reply = __('ticket creator', 'wpsc-support-tickets');
									} else {
										if($result['last_updated'] > $result['last_staff_reply']) {
											$last_staff_reply = __('ticket creator', 'wpsc-support-tickets');
										} else {
											$last_staff_reply = '<strong>'.__('Staff Member', 'wpsc-support-tickets').'</strong>';
										}
									}
                                    $output .= '<tr><td><a href="admin.php?page=wpscSupportTickets-edit&primkey='.$result['primkey'].'" style="border:none;text-decoration:none;"><img style="float:left;border:none;margin-right:5px;" src="'.plugins_url('/images/page_edit.png' , __FILE__).'" alt="'.__('View', 'wpsc-support-tickets').'"  /> '.base64_decode($result['title']).'</a></td><td>'.$result['resolution'].'</td><td><a href="'.get_admin_url().'user-edit.php?user_id='.$result['user_id'].'&wp_http_referer='.urlencode(get_admin_url().'admin.php?page=wpscSupportTickets-admin').'">'.$theusersname.'</a></td><td>'.date('Y-m-d g:i A',$result['last_updated']).' '.__('by', 'wpsc-support-tickets').' '.$last_staff_reply.'</td></tr>';
                            }
                            $output .= '</tbody></table>';
                        }

My question is, what coding would I need to enter here to do this and where?

It would be fab if someone could help.

Caroline.

DanF89 on "How to get book cover from Google Books utilizing ISBN entered in custom field??"

0
0

I'm running a theme that has a custom post types built in, and essentially what I need to do is display a book cover on the post (actually a custom post) page when the ISBN was already entered into a custom field when the post was created.

I understand the link that shows info from Google Books, but what I do not understand is how to pass that info onto WordPress (or even where to begin!). I would very much appreciate it if someone could at least point me in the right direction.


aenimaleye on "Exclude blockquote from being displayed in excerpt"

0
0

On most, if not all, of my posts there will be a blockquote at the top of the post to introduce a theme or topic, followed by the content of the post. I only want them both to be displayed when the single post is being viewed, otherwise I'd like to have the excerpt in searches or through searching categories, etc. only show the content that I've created without displaying the blockquote up top. I've searched for this and results have come up, which I have tried unsuccessfully. The most relevant that I have found are here and here and here.

I have used the suggestion from alchymyth (in the 2nd link):
example:
body.category blockquote { display: none; }
and that removed the blockquote, but also the rest of the content after the blockquote in the excerpt.

Problem is, as I'm very new to both css and php I'm not entirely sure if I've been implementing any of the instructions correctly. If anyone knows how to do this, could you please clarify where and what (which _____.php or if in css) I need to edit. I am using twentyeleven and have a child theme setup and can introduce new code in a file there.

I am also running the Advanced Excerpt plugin, which seems to help somewhat with what I'd like to do, but also may be preventing changing some functionality.

The site is bitingmyteeth.org, but all visitors will get as of yet is an error404 as all of the posts and pages are set to private for now until I get the site functioning the way I'd like. Thanks for any and all help. (Sorry for long explanation, but wanted to be as thorough as I could...)

bjarvis2785 on "WP Query Post by Post ID"

0
0

I'm trying to create a new template for my theme.
What i want to do is actually only show one result in the template.

So i need to get post id from the url (which i believe is a standard function), and then pass that post_id in to the query so that the template only shows that one post...

Can i filter by post id as i can't seem to find anything that says i can?

Any advice on this?

Thanks,

Barry

bushal on "Cannot seem to force XMLRPC posts to pending status"

0
0

Hi, this is probably one of those simple stupid things, but I am trying to force all posts created via xmlrpc to be reviewed on the admin interface before being published. Foolishly I thought this would be easy, but I cannot get anything to work, either via xmlrpc_publish_post or xmlrpc_wp_insert_post_data. This last is shown below. It does nothing when inserted in an active plugin, and I just can’t see why (I have gradually reduced any complexity to what seems the limit and I am starting to get paranoid!).

add_filter('xmlrpc_wp_insert_post_data', 'mcwag_post_status', '99');
function mcwag_post_status($data) {
    $data['post_status'] =  'pending';
   return $data;
}

hdmhos on "Centralize and Automatic Plugin Data Synchronization"

0
0

Can anyone help with a viable solution?

We are updating a fantasy football plugin that will be converting into mobile app and install in wordpress sites as well.

Update of plugin data (e.g. match outcomes)?
I want to centralize and be able to update the data for all who have the download the plugin and installed it on their website and all who have downloaded the mobile version of the plugin as an app on their mobile phone as well...

Issue #1
In case of plugin update:
No, updating the plugin via the WordPress servers would overwrite your customizations.

Issue #2
In case of data update:
How do I add functionality for syncing data?

Possible Solution?
For the plugin data to be automatically updated, two things must be done (as far as I can see now): data sync (table data from one server to another) and a recalculation of the ranking after the data sync is done.

Do you have any suggestions on how to achieve this?

Thank you.

mighty.one on "Making Product Titles Hyperlinked on Products Catalog Page"

0
0

Hello everyone,

Sorry, not sure if this is right for the Hacks subforum. I have a problem with my woocommerce.

Basically, on my product (catalog) pages (where products are viewable in a grid), the image is linked to the product detail page but the product title isn't and is just plain text.

Is there anyway to make the product title hyperlinked to the product details page too?

I think it's a pretty easy fix but not sure how to do it.

Any help will be much appreciated.

Thanks.

webifish on "Find depth of nested shortcodes"

0
0

Hi there,

I'm trying to find a way to write a PHP function using recursion that finds the maximum depth of short codes inside other short codes,

Any ideas ? or a lead on how to do that ?

Abhik on "Best Practice for Conditions"

0
0

What is the best practice to implement conditions? Within callback or wrapping the hook?

Like,

function myfunction() {
	if ( get_option() ) {
		// Do Something
	}
}
add_action( 'hook', 'myfunction' );

Or,

function myfunction() {
	// Do Something
}
if ( get_option() ) {
	add_action( 'hook', 'myfunction' );
}

chiaroscuro1 on "Need to tweak code for contact form"

0
0

I need someone to help me with a minor tweak to some contact form code.

I added two custom fields in a contact form a " Phone field" and a "Title, Company" field. They both look great.

I found some code that allows the phone number entered in the contact form field to appear in the email body. It works great. I tried to tweak that code so that the info in the "Title, Company" field also appears in the email body. However, although the field title is showing up, the info that is entered in the field doesn't.

PLEASE DO NOT recommend Contact Form 7. I have tried that plug-in and it does not look good with the theme, and it inserts the contact form in the wrong place and is more of a hassle than figuring out how to fix this minor probleem. It seems like a minor tweak to the code (see below) is all that I needs. Thanks for any help, in advance. My url is http://www.catalysthealthmedia.com, you can see the contact form there.

Currently, this is what appears in the email body:

Phone No: 973-761-1980
Title,Company:
Are you available for a project?

This is the mail code:

wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ), sprintf( '[%s] ' . sanitize_text_field( $_POST['et_contact_subject'] ), $et_site_name ), esc_html('Phone No: ' . $_POST['et_contact_phone'] . "\r\n" . 'Title,Company: ' . $_POST['et_contact_Title, Company'] . "\r\n" . $_POST['et_contact_message'] ),apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email ) );

This is the code for the fields:

p class="clearfix">
<label for="et_contact_Title, Company" class="et_contact_form_label"><?php esc_html_e('Title, Company','SimplePress'); ?></label>
<input type="text" name="et_contact_Title, Company" value="<?php if ( isset($_POST['et_contact_Title, Company']) ) echo esc_attr($_POST['et_contact_Title, Company']); else esc_attr_e('Title, Company','SimplePress'); ?>" id="et_contact_Title, Company" class="input" />
</p>

<p class="clearfix">
<label for="et_contact_email" class="et_contact_form_label"><?php esc_html_e('Email Address','Foxy'); ?></label>
<input type="text" name="et_contact_email" value="<?php if ( isset($_POST['et_contact_email']) ) echo esc_attr($_POST['et_contact_email']); else esc_attr_e('Email Address','Foxy'); ?>" id="et_contact_email" class="input" />
</p>

<p class="clearfix">
<label for="et_contact_phone" class="et_contact_form_label"><?php esc_html_e('Phone','SimplePress'); ?></label>
<input type="text" name="et_contact_phone" value="<?php if ( isset($_POST['et_contact_phone']) ) echo esc_attr($_POST['et_contact_phone']); else esc_attr_e('Phone','SimplePress'); ?>" id="et_contact_phone" class="input" />
</p>


[Please use the code buttons when posting code here]

mgkoller on "Displaying a custom field in Category Archives"

0
0

I am using WordPress 3.5.1 / Twenty Twelve Theme.
I would like to display a custom field in my Category Archives.
I have the following custom field working in my single.php , it displays a custom url / title

<a href="http://<?php echo get_post_meta($post->ID, "user_submit_url", true); ?>" target="_blank">  <h1 class="entry-title"><?php the_title(); ?> </a> <br /> <!-- Inserts the submitted url to the title -->

I would like to put the following code underneath the "entry-title" in Category Archives. I am confused of were to put the following php code, either in category.php or archive.php?
Since I need to put this code inside the loop, I want the code to register on every post just like it registers in the single.php in the example I provided above.
Something like the following, I presume?

get_post_meta($post->ID, "user_submit_url", true);

Let me know if I need to clarify anything.

clickmac on "Save Changes function after sorted"

0
0

I have a simple table, and the jquery works great for sorting. The fields drags an drops perfectly, and updates then and their. Also of course the data in the fields are saved in a array. The data in the fields saves after clicking "save changes" button but NOT the sort order. The sort order returns to its previous state.

example:
1(bb)
2(tom)
3(fred)

TO

1(tom)
2(bb)
3(fred)

then clicks "save changes"

the sort order does NOT save only the values. what other function i am suppose to add, to make this work?
The jquery works, it does its job of sorting, but for WordPress to understand that it was sorted another way, what do I do?

purcebr on "filter hook to add options to the Walker_Nav_Menu_Edit walker"

0
0

Hi There!

I've set up a custom plugin to allow my user to edit each
li's background color from the Menu edit area. It adds a farbtastic color picker to each menu item, by using the wp_edit_nav_menu_walker to replace the Walker_Nav_Menu_Edit walker with a custom one. I copied out the default walker from core, copied it to a new custom walker, and made my *small* change to get the color picker to show.

This works, and everyone is happy.

But shouldn't there be a filter_hook to add a custom option to the Walker_Nav_Menu_Edit walker without overriding the whole thing? So my plugin is working, but what if I wanted to make another change to the edit walker from another plugin - one plugin's change would cancel out the other, right?

I'm wondering if there's an opportunity to improve the Walker_Nav_Menu_Edit to be with a filter hook or two to allow for custom menu options without overriding the whole walker? Maybe I'm getting ahead of myself, but I love the opportunity to contribute a patch if it could help.

thanks a bunch!!!

Bryan

edtiley on "Undefined Function Fatal Error In Plugin Class"

0
0

Building a plugin using Class structure.

Want to display the result of a formula, so I created a public function so it could be done as needed. Something like:

public function foo($x,$y) {
   return strval(($x+$y)*2.2) ;
  }

I keep getting an undefined function. Finally I put the function in functions.php and it works like a champ. So it's obvious the function isn't getting loaded.

I've tried using init and plugins_loaded in add_action calls, but the function is still not available.

Surely there's a fairly simple way of making the function available inside the plugin without having to hook it. Isn't there?

TIA
Ed

Viewing all 8245 articles
Browse latest View live




Latest Images