I just found a wired thing on my website after v4.4 update. In my blog pages I use 2 functions to fetch comments.
First I use
wp_list_comments( array( "callback" => "checkout_comment", "type" => "comment") );
To fetch the comments only. Then I run a count check if any trackbacks exists by using
$trackback_count = get_comments( array(
'status' => 'approve',
'post_id'=> get_the_ID(),
'type'=> 'pings',
'count' => true)
);
and if the do exists the I show the trackbacks/pingsbacks like this
wp_list_comments( array( "callback" => "checkout_comment", "type" => "pings", "reply_text" => null, "format" => "html5") );
Now, after v4.4 update the comments are showing fine but the trackbacks list are not showing.
Can anyone tell me why? What I might need to change to fix this?
Related
I am trying to build a custom element for WPBakery Page Builder with a dropdown where custom taxonomy elements (categories) are listed.
Unfortunately I end up with empty dropdown elements. What am I doing wrong here?
The $options array gets filled perfectly when I var_dump it.
$terms = get_terms(array(
'taxonomy' => 'team',
'hide_empty' => false,
));
$options = array();
foreach($terms as $team) {
$options[$team->name] = $team->slug;
}
This is my params array inside the vc_map() function:
'params' => array(
array(
'type' => 'dropdown',
'holder' => 'div',
'class' => '',
'heading' => 'Team',
'param_name' => 'category',
'value' => $options
)
)
We had the same problem today.
After four hours fiddling around and trying everything, we finally found out that we were using a reserved word as our param_name, it was post_category, which by the way, is not on the Codex's Reserved Terms page, even though it definitely was one of them.
label also isn't on the list, but given that the error and behaviour was exactly the same, I'd advice trying to switch it for something else.
This is my first question on StackOverflow! I'm a PHP and WP developer beginner, and I'm doing my best to learn and pull information together, but I'm stumped.
I'm using Ninja Forms for WordPress. I want to return a full list of users and have them display in the drop down selection. The code below is based off this: Foreach loop inside array.
$blogusers = get_users( array( 'fields' => array( 'user_email') ) );
$args = array(
'name' => 'Select User',
'edit_options' => array(
array(
'type' => 'select',
'name' => 'select_users_from_group',
'label' => 'Select a User',
'options' => array()
),
),
'display_function' => 'select_users_from_group',
'edit_function' => 'select_users_from_group_edit',
'sidebar' => 'template_fields'
);
foreach($blogusers as $key=>$user) {
$args['edit_options'][0]['options'][] = array(
// 'name' => $user=>user_email,;
);
}
if( function_exists( 'ninja_forms_register_field' ) ) {
ninja_forms_register_field('select_users_from_group', $args);
}
I know my foreach loop is no good, but I don't know what to do to make it work. It fails when I remove the comment.
Eventually, I'd like for another field to return a user_meta value based on the user selected here, but I have no idea where to even begin on that.
Any help is appreciated. Not looking for you to write it for me. I'd rather learn how it works. Thanks in advance!
How can one change the order on each subpanel either by code or through the GUI?
In Sugar 6 the user could change the order simply by dragging and dropping the subpanels under each module.
From what I can see this is not possible in 7.x.
I have tried to change
'order' => 1
in
custom/Extension/modules/Opportunities/Ext/Layoutdefs/some_file.php
with no luck at all..
UPDATE:
As UTAlan stated,
this will become part of the stock functionality of Sugar starting in version 7.5.0: https://web.sugarcrm.com/support/issues/66590
Until then, here is the reason and the solution:
The 'order' => 1, does not seem to work on Sugar 7 at the moment.
Solution
Copy the file
modules/Opportunities/clients/base/layouts/subpanels/subpanels.php
to
custom/modules/Opportunities/clients/base/layouts/subpanels/subpanels.php
Now, add your custom subpanel definition to the beginning of the array or in any order you desire.
My example looks like this now:
$viewdefs['Opportunities']['base']['layout']['subpanels'] = array(
'components' => array(
// This is my custom module
array(
'layout' => 'subpanel',
'label' => 'LBL_OPPORTUNITIES_FOOBAR_TITLE',
'context' => array(
'link' => 'opportunities_foobar_1',
),
),
.. // Code ommited
array(
'layout' => 'subpanel',
'label' => 'LBL_EMAILS_SUBPANEL_TITLE',
'context' => array (
'link' => 'archived_emails',
),
),
),
'type' => 'subpanels',
'span' => 12,
);
Long Answer:
Why is 'order' => 1 not working anymore?
Inside include/MetaDataManager/MetaDataConverter.php:327:
public function toLegacySubpanelLayoutDefs(array $layoutDefs, SugarBean $bean) {
..
foreach ($layoutDefs as $order => $def) {
..
$return[$def['context']['link']] = array(
'order' => $order,
..
}
The order that is being rendered in the view is based on which order each bean-name is inserted inside the 'components'-key inside this file:
modules/Opportunities/clients/base/layouts/subpanels/subpanels.php
Core modules are hard-coded inside the subpanel file for Opportunities.
This will become part of the stock functionality of Sugar starting in version 7.5.0: https://web.sugarcrm.com/support/issues/66590
I have model IndividualSystemSerialNumber in cakephp1.3 and when i try to group by mac_address pagination not working.
But when i remove group from paginate , it's working fine.
$this->paginate = array(
'order' => $order_by,
'group' => 'IndividualSystemSerialNumber.mac_address',
'page' => intval($page),
'limit' => $this->params['url']['iDisplayLength']
);
$systems = $this->paginate('IndividualSystemSerialNumber');
I had same problem as you have now i don't know but paginate has some problem when you use group option.
So here is alternative solution that will work just awesome.
Example
$systems = $this->IndividualSystemSerialNumber->find('all',array
(
'order' => $order_by,
'group' => 'IndividualSystemSerialNumber.mac_address',
'page' => intval($page),
'limit' => $this->params['url']['iDisplayLength'],
'fields' => array
(
'IndividualSystemSerialNumber.mac_address',
//other related fields.
)
));
You have $page that is number of page you are requesting and Model::find() has option called page that accept currently requested page number and you also have limit set so above code will work as $this->paginate();
Cheers Enjoy Coding.
The following query returns an array containing the proper ids, but null for all values.
If I remove the aggregation function (AVG()), it returns values (not the averaged ones of course), if I choose e.g. find('all') it returns the average, but not in the list format I want (I could work with that, but I want to try to do it with 'list' first).
$progress = $this->Trial->find('list', array(
'fields' => array(
'Trial.session_id',
'AVG(Trial.first_reaction_time_since_probe_shown) AS average_reaction_time'
),
'group' => 'Trial.session_id',
'conditions' => array(
'Trial.first_valid_response = Trial.probe_on_top',
'TrainingSession.user_id IS NOT NULL'
),
'contain' => array(
'TrainingSession' => array(
'conditions' => array(
'TrainingSession.user_id' => $this->Auth->user('id')
)
)
),
'recursive' => 1,
));
The generated SQL query returns exactly the result I want, when I send it to the DB via PhpMyAdmin.
SELECT
`Trial`.`session_id`,
AVG(`Trial`.`first_reaction_time_since_probe_shown`) AS average_reaction_time
FROM
`zwang`.`trials` AS `Trial`
LEFT JOIN
`zwang`.`training_sessions` AS `TrainingSession` ON (
`Trial`.`session_id` = `TrainingSession`.`id` AND
`TrainingSession`.`user_id` = 1
)
WHERE
`Trial`.`first_valid_response` = `Trial`.`probe_on_top`
GROUP BY
`Trial`.`session_id`
I've examined the source for find('list'). I think it's due to the "array path" for accessing the list getting screwed up when using functions in the query, but I couldn't fix it yet (or recognise my abuse of CakePHP logic).
Once I posted the question, Stackoverflow started relating the correct answers to me.
Apparently, it can't be done with 'list' without virtualFields.
I didn't expect that because it worked using the other find-types.
$this->Trial->virtualFields = array(
'average_reaction_time' => 'AVG(Trial.first_reaction_time_since_probe_shown)'
);
$progress = $this->Trial->find('list', array(
'fields' => array('Trial.session_id','average_reaction_time')
/* etc... */
));