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

boybawang on "Error handling"

$
0
0

Hello -

I'm a newb with WP plugin development, so take it easy :)

Is there any problem in storing an API in the DB as cleartext? The problem I'm running into (during the development phase) is that I've had a couple of warnings that display my API call in the browser, which is obviously not good once it goes live.

If it's good practice to store APIs as text, how can I handle the warnings/notices/errors/exceptions so that sensitive data is not displayed in the browser?

Thanks


Mrgem79 on "custom css for pre ordering"

$
0
0

Hi all i am using Virtue theme and woocommerce for my business and was curious if there was a free way of doing pre ordering. as all stock is custom made i was hoping to have a pre oder part

any help would be great

thanks

mwxjm on "Change Sorting Page Stati WP-Admin"

$
0
0

I want to change the sorting of the page status on the edit page for posttype Page in WP Admin section.
So that instead of 'All | Published | Draft' it should be 'Published | All | Draft'.
Does anybody know how to manage this? Thanx in advance...

Sam Singh on "Hack"

$
0
0

I am using wordfence security and today, Right now my website is under attack.
I have received 30 emails of users who are locked out. Please help me because emails/ attempts are still increasing.

Thank You

ckbuilds on "Force registration, use CF7, have data sent to CC"

$
0
0

I need to:

Force users to register or login before viewing content
Upon registration, I need the information entered on the form to also be submitted to Constant Contact

Ideally, the user will see an excerpt and then a "to continue, please login or register" link. On click, the registration (hopefully contact form 7) or login form will come up. Once the form is filled out, the user will be automatically logged in, the information entered into the form will go to Constant Contact, the popup will close, and the user will be directed back to the content he was trying to view in the first place.

Is there some way I can do this?

SPINSYR on "Different Frontend and Backend Author Names"

$
0
0

I am setting up a multi-author blog, but I only want one "author" to be publicly displayed. The problem with changing all the "display names" to one selection is that it makes it difficult throughout the whole backend to see what user has posted/edited/etc certain content (because they all share one public name).

Normally I would just remove the author meta from the front end altogether, but in this instance we're also using jetpack email subscriptions and thus the author's name is displayed in the sent messages.

How can I display one unified author name on the frontend and several user-specific names on the backend?

zambo84 on "Author notification page"

$
0
0

Hi all,
i have found this code for the post

function notifyAuthorOnPostModification() {

  global $post;

  $author   = get_user_by( 'id', (int) $post->post_author );

  $to       = $author->data->user_email;

  $subject  = 'A post of yours has been modified';

  $message  = "Your Article '" . $post->post_title . "' (" . get_permalink( $post->ID ) . ') has been modified on ' . date( 'Y-m-d (H:i:s)', time() ); // Or something like that

  wp_mail( $to, $subject, $message );

}

And it Work, but i need the code for the Pages
There are any solution pls?

komani on "Displaying email and phone number"

$
0
0

Hi guys, I am in serious need of some help.
On my website when you purchase something, I get sent an email with information of what has been purchased as well as your email adress.
Now,I have added a custom field where you type in your phone number. The field works just fine but in the email I receive, I do not get the number you typed it. The email just says: Phone:

Again, the email adress gets shown correctly, but now the phone number. So, I hope we can figure out what I am missing or doing wrong. I have copied the code for the email (which works) and the code I have made for the phone number below.

In the email that gets sent, this is the PHP code:

echo __( 'Email:', 'ywraq' ); echo $raq_data['user_email'] . "\n";
echo __( 'Phone:', 'ywraq' ); echo $plain_text['user_phone'] . "\n";

This is the PHP code for the email found in the form of the checkout:

<p class="form-row form-row-wide validate-required" id="rqa_email_row">
                <label for="rqa-email" class=""><?php _e( 'Email', 'ywraq' ) ?>
                    <abbr class="required" title="required">*</abbr></label>
                <input type="email" class="input-text " name="rqa_email" id="rqa-email" placeholder="" value="<?php echo $user_email ?>" required>
            </p>

And finally, the one I added for the phone number:

<p class="form-row form-row-wide validate-required" id="rqa_phone_row">
                <label for="rqa-phone" class=""><?php _e( 'Phone', 'ywraq' ) ?>
                    <abbr class="required" title="required">*</abbr></label>
                <input type="text" class="input-text " phone="rqa_phone" id="rqa-phone" placeholder="" value="<?php echo $user_phone ?>" required>
            </p>

Anyone with an idea of what I need to do in order to get the phone number shown in the email as well?
Hoping for some help, this has been killing me.

Thanks in advance.


Steven on "WooCommerce remove Add to Cart based on user role"

$
0
0

Hi all, I hope someone is able to point me into the right direction.

I'm looking for a method to remove the "Add to Cart" buttons (both on the shop/archive pages as well as on the product page) for only a selected set of products.

This should be user role based. So IF someone is logged in AND belongs to the required user role then that user should just see the Add to Cart to allow that user to order the product.
ALL OTHER users, including not logged in users, should NOT be able to order the product and should just see "View Product" (or "Read More" in some themes) when they are on the shop/archive pages and on the product page they should NOT see the button to add the product to their cart.

Does anyone know how to do this?

boolean maybe on "Pushing data into the $options array from the settings page"

$
0
0

Hi all,

I'm currently developing a testimonial plugin. The testimonials are to be stored in an array.
I have an settings page where the admin is to add new testimonials. However it saves the form as an array into $option. I cant seem to find a way to push new data in that array it just save one array.

He is the code for the setting page:

`
function JWidget_settings_init( ) {

register_setting( 'pluginPage', 'JWidget_settings' );

add_settings_section(
'JWidget_pluginPage_section',
__( 'Add a widget', 'wordpress' ),
'JWidget_settings_section_callback',
'pluginPage'
);

add_settings_field(
'img',
__( 'Image URL:', 'wordpress' ),
'JWidget_text_field_0_render',
'pluginPage',
'JWidget_pluginPage_section'
);

add_settings_field(
'url',
__( 'Name', 'wordpress' ),
'JWidget_text_field_1_render',
'pluginPage',
'JWidget_pluginPage_section'
);

add_settings_field(
'rev',
__( 'Rating:', 'wordpress' ),
'JWidget_select_field_2_render',
'pluginPage',
'JWidget_pluginPage_section'
);

add_settings_field(
'txt',
__( 'Review', 'wordpress' ),
'JWidget_textarea_field_3_render',
'pluginPage',
'JWidget_pluginPage_section'
);

}

function JWidget_text_field_0_render( ) {

$options = get_option( 'JWidget_settings' );
?>
<input type='text' name='JWidget_settings[img]' value='<?php echo $options['img']; ?>'>
<?php

}

function JWidget_text_field_1_render( ) {

$options = get_option( 'JWidget_settings' );
?>
<input type='text' name='JWidget_settings[url]' value='<?php echo $options['url']; ?>'>
<?php

}

function JWidget_select_field_2_render( ) {

$options = get_option( 'JWidget_settings' );
?>
<select name='JWidget_settings[rev]'>
<option value='1' <?php selected( $options['rev'], 1 ); ?>>4/5</option>
<option value='2' <?php selected( $options['rev'], 2 ); ?>>5/5/option>
</select>

<?php

}

function JWidget_textarea_field_3_render( ) {

$options = get_option( 'JWidget_settings' );
?>
<textarea cols='40' rows='5' name='JWidget_settings[txt]'>
<?php echo $options['txt']; ?>
</textarea>
<?php

}

function JWidget_settings_section_callback( ) {

echo __( 'Add a new plugin to be randomly generated. All fields must be filled out before submiting.', 'wordpress' );

}

function JWidget_options_page( ) {

?>
<form action='options.php' method='post'>

<h2>JWidget</h2>

<?php
settings_fields( 'pluginPage' );
do_settings_sections( 'pluginPage' );
submit_button();
?>

</form>
<?php

}

?>

Stephenloky on "Creating a Fully Customized Website is possible?"

$
0
0

Hello everyone, first post here, so I'm sorry if I'm doing something wrong :P.
I would like to create from scratch a system based in PHP, my doubt is if I can create it inside WordPress, because I need to customize it entirely, for example, if I need to add buttons to a page and each button does some kind of action with Database Interaction....Is it possible to do that inside WordPress? If no, what should I search in the internet for help? CMS with more customization? A simple IDE PHP and create all from scratch?
I just want to create a fully customized website with template and login system (and plugins) from wordpress.

Sorry if the question is duplicated.

Thanks in advance.

scoobydino on "HELP! Custom Field URL"

$
0
0

I have created custom fields in my themes functions.php file which adds custom fields to my front end and my backend. In one of the fields I want to be able to add a URL eg: http://www.mysite.com so when entered in on the back end it show up as a link on the front end display.

How do you do this?

dgcov on "Post Meta Data: How does it work?"

$
0
0

I'm Designing a post type with 3 membership levels:

Master, Member and Viewer.

The Master can manipulate the post content in the database, the Member has restricted access and the Viewer has read-only access.

I'm adding the information by the way of meta data:

update_post_meta( $post_id, '_membership', array('master'=$userID) );

What I want is to be able to tell what level of access the current user has. Obviously the 'master' will have only a few entries, the 'member' will have a lot more and the 'viewer' will have loads more still.

The problem is that the documentation suggests that updating the meta data will overwrite all the values in the array.

What would be the best way of handling this?

Jamel.Z on "How to change language on a specific admin page"

$
0
0

Hi everyone

all is in the title :)
in other words: which function I have to use to change language depending on the current admin page ?

Example :

I want to display the settings page always in 'French' even if the admin language is 'English'

iaw4 on "Learning to become a Wordpress (PHP) programmer"

$
0
0

I am an experienced perl programmer. I have written lots of cgi scripts.

I decided to jump ship. the future lies where 90% of web developers sit, and this seems to be php. and half of those sit with wordpress. I don't want to have to recode in perl, when there is a CMS that has 90% of what I want---blogs, user management concepts, etc.

from my perspective, wordpress is like part of php. I am learning the latter in order to program the former. wordpress should be like a library / IDE for php for me.

Alas, I now need to learn both php and wordpress. are there any focused books for wordpress php programming? I don't need books on html and css, or what a theme is. I already know this. I also don't want books using ancient versions with deprecated programming features and styles. I want to buy a book that teaches reasonably current wordpress/php, more or less as an integrated IDE ecosystem.

the google firehose gives me a lot of old cruft. I purchased "Modern Php", but it seems to be geared towards improving existing php programmers, and not on teaching the right language for php (much less for wordpress).

Recommendations? How do I become/learn to be a modern Wordpress programmer?


elmernite on "Img width and height HTML code generation location?"

$
0
0

When looking at the source code for an image embedded in a post. I see this.

<a href="IMAGELOCATION.jpg"><img class="alignnone size-full wp-image-503" src="IMAGELOCATION.jpg" alt="IMAGE NAME" width="932" height="1210" /></a>

My question: Where is the width="932" height="1210" getting generated in the wordpress code? I need to see if I can edit that (for reasons, I am trying to replace it with inline CSS style="max-width:932px; max-height:1210px;"). For the life of me I cannot find where it is generated. I modified the image_hwstring in media.php but it seemed to have no effect.
Thanks,

-Ken

P.S. Since I think this will require modifying core Wordpress functions I thought this went more under hacks than themes.

alexgagi on "Problem publishing a post using wp_update_post()"

$
0
0

Hello, I'm developing a plugin to convert a web in a photo contest website and I'm facing a problem I can't figure out the solution. What I do:
1. I have a front end form for the user to submit a CPT with a title and image. The CPT remains as a draft until someone takes a look on it.
2. On an options page I use a function to publish the posts and assign to them a custom taxonomy:

$idpost = get_the_id();
$my_post = array(
    'ID'			=> $idpost,
    'post_status'	=> 'publish'
);
wp_set_object_terms($idpost, 'votacion', 'temas_liga', false);
wp_update_post( $my_post );

3. I then have a single taxonomy template to show them. In that single page I have a form for the scoring of the image.
Everything works almost perfect: the images go to draft, then go to published and got the term, and I can see it on the single tax page.
But the field with the score is not showing. I can see the submit button, the form is created, even the div for the field, but it is empty when you see the html.
More funny is that if I go in the backend to edit the CPT and I just save the CPT without making any change, then I go to the frontend single page and then the scoring field appears.
I have an image to explain better, the image on the left has been saved on the backend and the image on the right has not been saved on the backend: Image

Thanks for your help.

HG22 on ".htaccess and where to access it"

$
0
0

I cannot find where .htaccess is. I need to make it writeable so that the Wordpress Landing Pages plugin works. Any help would be greatly appreciated!

dartiss on "403 error for some users"

$
0
0

One of my plugins (YouTube Embed), for some users, is breaking MCE with the following console error...

Failed to load resource: the server responded with a status of 403 (Forbidden)
Failed to load: [users URL]/wp-content/plugins/youtube-embed/js/mce4-button.min.php

The file in question is included in the plugin to add a new MCE button.

Does anybody have an idea why it may be generating a 403 when the file exists and is just part of the standard install?

luarb on "Embed Site URL and Home inside the code."

$
0
0

Hello ,

I'm trying to make 2 wordpress sites use the same database ,
i tried working on the prefix but there is nothing i can do to
about the Site Url and Home fields on Wp-option table ,
so i thought , if i put them inside the code when they get called ,
they wont have to query the table to get the urls ,
but i dont know where they are located
can anyone help ?

Viewing all 8245 articles
Browse latest View live