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

johncastlegate on "How to remove "Add Media" button in WP 3.5?"

$
0
0

In previous versions of WordPress, I could remove the media upload button with something like:

function z_remove_media_controls($context) {
    return;
}

add_action('media_buttons_context', 'z_remove_media_controls');

However, this does not seem to work in WordPress 3.5. How can I remove or hide the button now?


Bubbajuju on "Show Category Children But Hide "No Category" with Children List"

$
0
0
<?php
$cat_id = get_query_var('cat');
$catlist = get_categories('child_of=' . $cat_id);
if ($catlist) {
wp_list_categories('echo=0&orderby=id&title_li=&child_of=' . $cat_id);
} else {
//Now instead of "No Categories" showing I want to re-display the child categories

?>

Thanks for any help...

martin.kovac on "tinyMCE config file location"

$
0
0

Where can I find config file for tinymce editor?
To be precise I'm looking for valid elements that tinymce accepts.

Thanks

416BC on "Adding an options page to the USER dashboard?"

$
0
0

I am making a plugin, which will turn in to a membership site I'm hosting. I'd like the users to be able to go the dashboard, and besides editing their profile, I'd like an options page for settings I've defined.

The settings would only apply to that user, such as "email me everytime I login" or "What are your favorite stores" or "upload a picture of your dog".

The point is they aren't all yes or no, and they aren't all just text fields, I'll have a wide config of options, just as any plugin will.

Is there a way to allow each user access to their own config page?

blpraveen on "WordPress Editor switch between html and visuals not working"

$
0
0

I need to show the editor on my plugin dynamically. I tried using the javascript code to show editor

tinyMCE.settings = tinyMCEPreInit.mceInit.content;
  tinyMCE.execCommand('mceAddControl', false, textareaid);

But it doesnot show the upload and switch editors.

So I tired using an ajax in my javascript.
javascript

dataString = 'action=' + admin_object.action_editor + '&security=' + admin_object.action_editor_security + '&count=' + count;

    jQuery.ajax({
            type: "POST",
            url: admin_object.ajax_url,
            data: dataString,
            success: function(resultData){
                jQuery('.woocommerce_product_tab_wrapper').stop(true).css('opacity', '1').unblock();
                $div_group.append(resultData);
                $div_wrap.append($div_group);
                jQuery('.woocommerce_product_tab_wrapper').append($div_wrap);
                $div_wrap.css('display','none');
                tinyMCE.settings = tinyMCEPreInit.mceInit.content;
                tinyMCE.execCommand('mceAddControl', false, 'wptb_content_'+tab_count);
                switchEditors.switchto({'id' : 'wptb_content_'+tab_count+'-html'});
                jQuery("#wptb_content_"+ tab_count +"_ifr").contents().find(".qp").css("background-color","#00ff00");
                jQuery('.woocommerce_product_tab_wrapper .tabs').find('li.'+tab_title_slug + '_tab a').click();
                tab_count++;
            }
        });

Ajax function handler

public function get_editor() {
        check_ajax_referer( 'get-editor', 'security' );
        $tabcount = isset($_POST['count']) ? $_POST['tabcount'] : '';
        if(!is_numeric($count) && $count < 0) die();

        $settings = array(
            'quicktags'     => array( 'buttons' => 'em,strong,link' ),
            'textarea_name' => 'content[]',
            'quicktags'     => true,
            'tinymce'       => true,
            'editor_css'    => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;background:#FFFFFF;}</style>'
            );

        wp_editor( htmlspecialchars_decode( '' ), 'content_'.$tabcount, $settings );
        die();
    }

It shows me the upload and the switch editor. But now another error crops up. Initially editor is switched to html mode and buttons shown are visual. When I click the switch editor button to html the editor goes off.

Can any body help to show the editors by using the javascript.

Thanks

MatthewRuddy on "Image Resizing Function - An Alternative to Timthumb"

$
0
0

Hey all. I've been working hard on updating my plugin the 'Easing Slider'. A fairly massive update is on the way, and being a slideshow plugin image resizing is always a hot topic.

I had been using Timthumb (like a lot of people), but often spent quite a while looking for a WordPress based alternative. I came across the 'vt_resize' function, which initially I felt did the trick, until I found out it wouldn't upscale images (which was vitally needed). It wasn't a good enough solution.

So I bit the bullet and decided to come up with my own function. It is heavily based on some of WordPress's internal resizing functions, except it crops identically to Timthumb itself.

It also supports the upcoming WordPress 3.5 update (an alternative function is used via an 'if' statement), which gives us access to some handy image manipulation classes to ease the pain.

So far after a bit of testing it appears to be working very well. I'm really happy with it. It saves the resized images in the WordPress uploads folder, as per usual. This is great, because not only are the images resized but they are static files, which is ideal.

I've created a Github page for the function here. It is released under GNU general public license, so feel free to use it as you wish!

http://matthewruddy.github.com/Wordpress-Timthumb-alternative/index.html

There is only one drawback: it won't work with external images. It's just too complicated and slow to do so, and probably not worth the effort. If you need to resize an external image, save it to your computer and upload it to the WordPress Media Library. Then use it from there.

That's it really. If anyone finds any bugs, then let me know and I'll get them sorted quickly!

Now you've no excuse to use Timthumb at all!

kevin360 on "WP 3.5 - set title for image when inserting media"

$
0
0

Hopefully someone will be able to help me with this and it'll be an easy fix! In the previous version of WP I had changed the code so that when I inserted a new image into a post, the title which is shown in the media manager would be set as the title for the image inserted into the post.

With the upgrade to WP 3.5 the media manager has changed and I'm not sure how to get that back. The php code that does the actual inserting of html into the post appears to be wp-admin/includes/media.php. I've edited the get_image_send_to_editor function so that it does output the title where I want it, but I have to statically set the title. I would like the title to be taken from the media manager Title field for the image.

I've traced back to the file ajax-actions.php which is in wp-admin/includes, the function wp_ajax_send_attachment_to_editor, appears to be what sets up the variables that are used by the media.php file to output the code. In that function there's this line:

$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.*/

I've tried putting in code such as:
$title = $attachment['post_title']

but it doesn't work. If I put in this code:
$title = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';

It works and the html inserted into the post contains a title which is set to the alt field. But what I want is to set it to the title that's shown in the media manager. Anyone know how I can do that?

Thanks,
Kevin

WStringer2 on "How to report a catastrophic plugin exploit?"

$
0
0

Hello everyone,

Can someone tell me the best way to report a catastrophic plugin hack with posting the details of the exploit for all the web to see?

It's a plugin that is in the WP Plugin Repository, and with a malformed URL I can initiate a procedure (within the plugin) that deletes ALL of the images in the WordPress database. Unfortunately, I speak from experience as this happened to us.

Thankfully it's not a very popular plugin, but it has been downloaded several thousand times so I'd like to warn people who may be using it...without posting details of the exploit.

Thanks,

Walt


rocked18 on "Post title link"

$
0
0

Hi,

I added the Fancy Post Stamp plug in and i have it looking as i want. But the post title links are now not linking to their own article pages. The post titles should be clickable so that people can open up just that one article on its own page.

Any help with this?

http://blog.blueventures.org/

Thanks

Robert A. Ruby II on "save post running twice and creating two database entries - how do I disable thi"

$
0
0

I am developing a job tracking database for my utility engineering company and am having an issue when running a save hook. I have a task_types db table that tasks are created off of and using a custom meta box on the "cover_page" (post edit screen) of the job I allow these tasks to be created for each job from user input. It is processing my validation code twice therefor creating 2 database entries and two identical tasks from its task type, which is not correct. Can anyone assist me with this problem. See the code snippets below.

// Validate Data    for Custom Meta Boxes
function rfd_argument_function() {
    global $post;
    global $rfd_meta_box_options; 

    foreach($rfd_meta_box_options as $rfd_meta_box_option){
            $meta_box_options[] = $rfd_meta_box_option['meta_box_form_fields'];
    } 

    foreach($meta_box_options as $options){
        foreach ($options as $option){
            if($option['name']){
                    $arguments = array(
                    'post_id' => $post->ID,
                    'name' => $option['name'],
                    );
            }
            do_action('save_hook', $arguments);
        }
    }
}
add_action( 'save_post', 'rfd_argument_function');

// Save data for Custom Meta Boxes
function rfd_save_meta_box_values( $args ) {
$post_id = $args['post_id'];
$name = $args['name'];
$old_data = get_post_meta($post_id, $name);
$new_data = $_POST[$name];

// Autosave, do nothing
 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
  return;
 }
 // Check permissions
 if ( 'page' === $_POST['post_type'] ) {
  if ( !current_user_can( 'edit_page', $post_id ) ) {
        return;
  }
 }else {
  if ( !current_user_can( 'edit_post', $post_id ) ) {
        return;
  }
 }
if( $_POST['job-update-action']==='freeze'){ // Freeze associated items updated below in save_rfd_job_update_action.
        return;
}
// AJAX? Not used here
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
        return;
}
// Return if it's a post revision
if ( false !== wp_is_post_revision( $post_id ) ){
        return;
}

// if new is same as old
if($new_data === $old_data[0] ){
     return;
}else{
    // add_post_meta($post_id, 'save-count', 0, true); // add "save-count" if none exists
    // $save_count = get_post_meta($post_id, 'save-count', true); // grab save count
    // if( $save_count == 0){
        // $save_count++;
         // update_post_meta( $post_id, 'save-count', $save_count );
        if($_POST['task-to-assign'] !== 'Select a Task Type to Assign'){
            global $wpdb;
            $table_name = $wpdb->prefix . 'task_types';
            $task_type = $wpdb->get_results("SELECT * FROM $table_name WHERE task_name = '" . $_POST['task-to-assign'] . "'", OBJECT);
            $table_name = $wpdb->prefix . 'tasks'; // Change table
            // check for duplicate task
            $task = $wpdb->get_results("SELECT * FROM $table_name WHERE task_name = '" . $_POST['task-to-assign'] . "' AND job_id = '" . $post_id . "'", OBJECT);

            // rfd_debugger( $task[0],1);
            // if( $task[0]->job_id === false){
                $rows_affected = $wpdb->insert( $table_name, array( 'task_type_id' => $task_type[0]->id,
                                                                'task_name' => $task_type[0]->task_name,
                                                               'description' => $task_type[0]->description,
                                                               'job_id' => $post_id,
                                                               'assigned' => $_POST['person-to-assign'],
                                                               'assigned_datetime' => current_time('mysql'),
                                                            )
                                        );
            // }
        }

    // }else{
        // delete_post_meta($post_id, 'save-count', 0);
    // }
    update_post_meta($post_id, $name, $new_data); // Add New Data
    update_post_meta($post_id, 'task-to-assign', 'Select a Task Type to Assign'); // Reset Field
    update_post_meta($post_id, 'person-to-assign', 'Select A Person'); // Reset Field
}

}
add_action( 'save_hook', 'rfd_save_meta_box_values');

collie_walkie on "problem with custom slugs in my plugin"

$
0
0

I'm having problems with a plugin, it renders according to the ID of a diary plugin, but the url is oddly shaped.

"localhost/system/diary/?aid=20"

I want it like this:

"localhost/system/diary/20"

I appreciate the help!

anup@xentrictechnologies.in on "wordpress default function is not working in my custom plugin,please help me."

$
0
0

i am new in plugin development.i am submitting a form in front end,after submitting i am showing a simple hello message.

but during form submission below error are showing:

Fatal error: Call to undefined function get_option() in C:\wamp\www\Anup\dating_world\wp-content\plugins\registration_form\registration_form.php on line 9
please help me
here is my plugin code:

<?php
/*
Plugin Name: Registration Form
Description: WordPress plugin for register user
Author: Anup
Version: 3.5.2
site:http://anupkoldhn.wix.com/anup
*/
$siteurl=get_option('siteurl');

define('REGISTER_FORM_FOLDER',dirname(plugin_basename(__FILE__)));
define('REGISTER_FORM_URL',$siteurl.'/wp-content/plugins/'.REGISTER_FORM_FOLDER);
define('REGISTER_FORM_FILE_PATH',dirname(__FILE__));
define('REGISTER_FORM_DIR_NAME',basename(REGISTER_FORM_FILE_PATH));

	add_action('front_display','front_display');
	add_shortcode('register','front_display');
function front_display()
{
	/*$user_data = array('ID' => '','user_pass' =>'anup123','user_login' => 'anup123','display_name' =>'anup123','first_name' =>'anup324','last_name' =>'baba44','role' =>'subscriber');
       echo "sggg".$user_id = wp_insert_user( $user_data );*/

	   if(isset($_REQUEST['submit']))
	   {
		   echo "hello";
	   }
?>

 	<table>
<form name="form" id="form" method="post" action="http://localhost/Anup/dating_world/wp-content/plugins/registration_form/registration_form.php" >
    <tr><td colspan="2" align="center"><span id="message"></span></td></tr>
    <tr><td>UserName:</td><td><input type="text" name="name" id="name" /></td></tr>
     <tr><td>Password:</td><td><input type="password" name="password" id="password" /></td></tr>
    <tr><td>Email:</td><td><input type="email" name="email" id="email" /></td></tr>
    <tr><td>Gender:</td><td><select id="gender" name="gender">
    							<option value="men">Men</option>
                           		 <option value="woman">Woman</option>
                             </select>
    </td></tr>
    <tr><td colspan="2" align="center"><input type="submit" value="Submit" name="submit" /></td></tr>
    </form>
    </table>

<?php

}
?>

[Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum's parser.]

chips on "Ideas for recording user transactions"

$
0
0

I'm developing a site for a client which requires a system to record a list of transactions for a user. Each transaction would need to record the date and value of the transaction.

My initial thought was to create a post type. However I think that is probably the wrong way to do it, especially as it would be hard to prevent Wordpress from creating an actual viewable post for each transaction.

Does anyone have any other ideas on how to handle this? User meta maybe?

paulhume on "Page Protection Password"

$
0
0

I have a need for the password to time out a lot quicker for protected pages in a wordpress site.

In older versions of WP I would edit the wp_pass.php file to achieve this. After the 3.4.1 update WP does not use this file anymore.

Does anyone know how I can change the timeout value on the page protection passwords?

Thank you in advance for your help.

Regards

Paul

Kasper on "Featured image are cropping my image!"


CyberAxe on "Changing Attachment URL"

$
0
0

I've replaced all attachment URLs from for example ?attachment_id=124 to media-view/124

I'm then using the following code to intercept and display the right content when someone goes to a media-view link.

function xhtml5responsive_query_parse( $query ) {
  if ( strpos($_SERVER['REQUEST_URI'], 'media-view/') !== false ) {
    $explode = explode ( 'media-view/', $_SERVER['REQUEST_URI']);
    $id = rtrim($explode[count($explode)-1], '/');
    if (is_numeric($id)) {
      $query->query_vars['cat'] = -2; // Exclude my featured category because I display that elseware
      $query->query_vars['posts_per_page'] = 5; // Show only 5 posts on the homepage only
      $query->query_vars['attachment'] = true;
      $query->query_vars['attachment_id'] = intval($id);
      $query->in_the_loop = true;
      $query->is_attachment = true;
    }
  }
}

The problem though is that it redirects media-view/124 to ?attachment_id=124

How can i make it just display the appropriate attachment instead of redirecting to attachment_id=124

Thanks.

Abhishek Kumar on "Different background image for Wrapper class on page id 2"

$
0
0

where are you "Esmi" I hope at-least you will reply for this...I need your help here..please give some time here as well.

sarahvenicebailey@gmail.com on "Hacked with redirect, help?"

$
0
0

Hello,

Alright, so I just bought a new domain and installed the new wordpress. I went through my host which is bluehost. I also purchased sitelock (yeah, lot of good it's done me...)

After installing wordpress I installed theme catch box and within 5 minutes I had notifications that my site had been hacked and was being redirected and that google was going to blacklist me. What!?!

This is what is says:
Suspicious conditional redirect.
Redirects users to:http://refireads.com/ads/

In everything I've read it says to check the .htaccess file, but 1. I can't find that and 2.is there a step by step on how to fix this type of thing?

Any help would be appreciated!

Nasgor on "Changing footer call"

$
0
0

Hi, I'm triying to chang the footer text by a plugin, I can add the new text, but the old one still apears. Can any body help me, pleas. Here is the code:

<?php
// AÑADIR FIRMA AL FINAL DE LA WEB
function custom_footer_text()
{
$content = '</div><!-- #main .wrapper -->';
$content .= '<footer id="colophon" role="contentinfo">';
$content .= '<div class="site-info">';
$content .= '<?php do_action( "twentytwelve_credits" ); ?>';
$content .= 'Desarrollado por Beñat Bustamante bajo Wordpress';
$content .= '</div><!-- .site-info -->';
$content .= '</footer><!-- #colophon -->';
$content .= '</div><!-- #page -->';

$content .= '<?php wp_footer(); ?>';
$content .= '</body>';
$content .= '</html>';
echo $content;
}
add_action( 'get_footer', 'custom_footer_text' );
remove_action( 'wp_footer', 'get_footer' );
?>

mossyboy on "Help: Update existing plugin for Twitter 1.1 API"

$
0
0

Hi

I have been developing a Wordpress site for someone which uses a the plugin Social Media Mashup which intergrates many social media RSS feeds into one.

Anyway, the site I was working on has been approved and needs to go live this weekend but Twitter updated its API a few nights ago and now the Twitter feed on said plugin no longer works which has left me in a right mess.

I can't get through to the developers and fixing it myself is way out of my virtually non-existent coding experience.

Does anyone want to help?!!

Thanks
Chris

Viewing all 8245 articles
Browse latest View live




Latest Images