- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
基本上,我想在我的 map 标记上添加标签,它返回我的 BuddyPress 的计数。每个位置的成员(就像 MarkerClusterer 生成的数字)以及当我点击它时重定向到特定的 Url。
此外,我想调整 MarkerClusterer将这些数字加在一起,而不是计算我在里面的标记的数量。
问题:我正在努力尝试调整插件中包含的功能 Progress Map而这个开发者显然懒得弄脏他的手。
无论如何,这是我想要的那种结果(红点中的白色标签):
我找到了使用以下代码检索每个位置的成员(member)数的方法:
<?php global $bp;
if ( bp_has_members( bp_ajax_querystring( 'members' ). '&per_page='.sq_option('buddypress_perpage') ) ) :
$region = array();
while ( bp_members() ) : bp_the_member();
$region[] = xprofile_get_field_data( 'Region' , bp_get_member_user_id() );//fetch the text for location
endwhile;
endif; ?>
/* print_r(array_count_values(array_map('strtolower', $region))); */
这是创建对象标记的调用:
/**
* Create the pin object */
var marker_object = cspm_new_pin_object(<?php echo $l; ?>, '<?php echo $post_id; ?>', <?php echo $lat; ?>, <?php echo $lng; ?>, '<?php echo $implode_post_categories; ?>', map_id, '<?php echo $marker_img_by_cat; ?>', '<?php echo $marker_img_size; ?>', '<?php echo $is_child; ?>');
json_markers_data.push(marker_object);
这里是 函数 cpsm_new_pin_object(我想这就是使用 Google Maps API 的地方):
function cspm_new_pin_object(i, post_id, lat, lng, post_categories, map_id, marker_img, marker_size, is_child){
/**
* [@map_script_id] | Used only to get map options from the PHP option wp_localize_script()
* @since 3.0 */
var map_script_id = (typeof progress_map_vars.map_script_args[map_id] !== 'undefined') ? map_id : 'initial';
post_lat_lng_coords[map_id][post_id] = lat+'_'+lng;
// Create an object of that post_id and its categories/status for the faceted search
post_lat_lng_coords[map_id]['post_id_'+post_id] = {};
post_ids_and_child_status[map_id][lat+'_'+lng] = is_child;
// Get the current post categories
var post_category_ids = (post_categories != '') ? post_categories.split(',') : '';
// Collect an object of all posts in the map and their categories
// Useful for the faceted search & the search form
post_lat_lng_coords[map_id]['post_id_'+post_id][0] = post_category_ids;
// By default the marker image is the default Google map red marker
var marker_icon = '';
// If the selected marker is the customized type
if(progress_map_vars.map_script_args[map_script_id]['defaultMarker'] == 'customize'){
// Get the custom marker image
// If the marker categories option is set to TRUE, the marker image will be the uploaded marker category image
// If the marker categories option is set to FALSE, the marker image will be the default custom image provided by the plugin
var marker_cat_img = marker_img;
// Marker image size
var marker_img_width = (progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true") ? parseInt(marker_size.split('x')[0])/2 : parseInt(marker_size.split('x')[0]);
var marker_img_height = (progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true") ? parseInt(marker_size.split('x')[1])/2 : parseInt(marker_size.split('x')[1]);
// Marker image anchor point
var anchor_y = marker_img_height/2;
var anchor_x = marker_img_width/2;
var anchor_point = null;
if(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point_option'] == 'auto')
anchor_point = new google.maps.Point(anchor_x, anchor_y);
else if(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point_option'] == 'manual'){
if(progress_map_vars.map_script_args[map_script_id]['retinaSupport'] == "true"){
anchor_point = new google.maps.Point(
progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[0]/2,
progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[1]/2
);
}else anchor_point = new google.maps.Point(progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[0], progress_map_vars.map_script_args[map_script_id]['marker_anchor_point'].split(',')[1]);
}
// Add retina support
marker_icon = new google.maps.MarkerImage(marker_cat_img, null, null, anchor_point, new google.maps.Size(marker_img_width,marker_img_height));
}
return pin_object = {latLng: [lat, lng], tag: 'post_id__'+post_id, id: post_id+'_'+is_child, options:{ optimized: false, icon: marker_icon, id: post_id, post_id: post_id, is_child: is_child }};
}
当然会出现在他的缩小版中:
cspm_new_pin_object(e,s,a,r,t,i,o,_,p){var n="undefined"!=typeof progress_map_vars.map_script_args[i]?i:"initial";post_lat_lng_coords[i][s]=a+"_"+r,post_lat_lng_coords[i]["post_id_"+s]={},post_ids_and_child_status[i][a+"_"+r]=p;var c=""!=t?t.split(","):"";post_lat_lng_coords[i]["post_id_"+s][0]=c;var m="";if("customize"==progress_map_vars.map_script_args[n].defaultMarker){var l=o,d="true"==progress_map_vars.map_script_args[n].retinaSupport?parseInt(_.split("x")[0])/2:parseInt(_.split("x")[0]),u="true"==progress_map_vars.map_script_args[n].retinaSupport?parseInt(_.split("x")[1])/2:parseInt(_.split("x")[1]),g=u/2,f=d/2,v=null;"auto"==progress_map_vars.map_script_args[n].marker_anchor_point_option?v=new google.maps.Point(f,g):"manual"==progress_map_vars.map_script_args[n].marker_anchor_point_option&&(v="true"==progress_map_vars.map_script_args[n].retinaSupport?new google.maps.Point(progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[0]/2,progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[1]/2):new google.maps.Point(progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[0],progress_map_vars.map_script_args[n].marker_anchor_point.split(",")[1])),m=new google.maps.MarkerImage(l,null,null,v,new google.maps.Size(d,u))}return pin_object={latLng:[a,r],label:'B',tag:"post_id__"+s,id:s+"_"+p,options:{optimized:!1,icon:m,id:s,post_id:s,is_child:p}}}
总结,这里有 2 或 3 件事:
最佳答案
嗯,由于您不直接使用 google maps api,因此很难获得帮助。我不知道它如何与 wordpress 一起工作,所以我忍不住修改实际代码...但我认为您可以忽略一些事情。
1) 对于带标签的标记,你有“最大”用户数吗?您可以为标记使用自定义图像您可以做的是为每个数字设置 1 个图像标记……除非您有太多。如果是,您可以使用自动生成的图像,例如 mysite.com/genMarker.php?number=98。这不是用 php 做的最难的事情。
2) 对于那里的 markercluster,您可能可以修改 markerclusterer,但我可以建议另一种方法:- 您继续添加带有自定义标签的“分组”标记(1 个标记用于 10 个用户),但您不会将它们推送到 markerclusterer- 您为每个用户添加 1 个标记(即,如果您有 10 个用户,则在同一位置添加 10 个标记)...使用透明图像标记:您将它们添加到您的聚类器中
然后你应该有正确的集群行为,而不必修改它的核心。
我不知道您是否可以选择"is"或“不”向集群添加标记……但这是一种更简单的方法。我知道这很难看,但我认为它可以工作;)
关于javascript - WordPress - Google Map API 标签/进度图 + BuddyPress 成员(member)数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45274313/
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 10年前关闭。 Improve this qu
所以我有 Buddypress 中某人的用户 ID。 打印出他们的头像的功能是什么? 链接到他们的个人资料的功能是什么? 最佳答案 这将按用户 ID 显示用户头像,并使头像成为指向其个人资料的可点击链
这是关于一个 buddypress 插件(插件),我无法对其进行主题化。我搜索了很多网站,但无法获得具体的解决方案。在插件页面中,如果它是 buddypress 主题,Header 会受到干扰,但在默
我已经使用自定义配置文件字段设置了 BuddyPress,该字段列出了与我的网站相关的标签的复选框。 有没有办法在新帖子发布时根据注册的 BuddyPress 用户的自定义个人资料字段选择向其发送自动
我向我的个人资料页面添加了一个额外的事件提要,用于查询链接的用户并返回他们的事件。问题是,我想将其写入函数,因为网站的其他区域通常需要使用相同的查询。 这是用户查询。这只是一个查找并返回链接用户 ID
我刚刚在无字安装中安装了 buddypress,想创建一个具有自定义样式的子主题。 我已经按照 buddypress codex 的建议从 plugins>buddypress>bp-template
我正在使用 WordPress 和 BuddyPress 创建一个网站。注册应该向所有拥有 .edu 电子邮件地址的人开放。 如果我使用的是 vanilla WordPress,那么使用 regist
我正在使用以下代码在模板中显示登录用户的未读消息计数。 这很好用,但是它需要刷新页面才能更新。由于我在整个站点中大量使用
我正在使用 wordpress multisite 以及安装的 buddypress。 我想为更新帖子的用户添加一个事件。但是,它不起作用。没有添加事件。 这是我的代码: function buddy
我正在使用 WordPress 和带有 suffusion 主题的 buddypress 建立一个网站。都是最新的。像往常一样,我有垃圾邮件发送者注册并禁止他们作为注册。我在 htaccess 文件中
有没有办法在 BuddyPress 成员(member)资料页面下添加额外的自定义标签?我的意思是事件、个人资料、消息等旁边的自定义选项卡。 最佳答案 有一个插件叫BuddyPress Custom
我在 WordPress 安装上使用 buddypress。我想将一个 user_id 数组放入一个变量中,然后我可以使用该变量进行操作,例如,在 HTML 中列出或向其发送消息。 我尝试使用以下代码
我正在设置一个 Wordpress 页面,我正在尝试自定义 buddypress 组的外观。我希望它们水平显示而不是垂直显示。谁能指导我完成?
我有一个模板,它显示一个带有图像的气泡。但我想用 Wordpress 中登录用户的头像替换这张图片。 我该怎么做? 这是我的部分代码:
我刚刚在我的 wordpress 驱动的网站上安装了 buddypress,我想防止管理栏在您向下滚动时跟随屏幕。我怎样才能让它在页面顶部保持静止,并让它在您向下滚动时消失在视野之外? 感谢您的帮助。
在 buddypress 将详细信息保存到 mysql 数据库后,我试图将用户和组的详细信息保存到 Active Directory (LDAP) 中。 我可以在哪里放置代码以在 LDAP 中保存用户
我想在配置文件设置中隐藏子导航 我隐藏子导航评论“wp-content\plugins\buddypress\bp-settings\bp-settings-loader.php” // Add Ge
当用户上传新头像时,头像会发布在事件墙中。 如何使用 userId 获取此事件 ID? 我认为唯一的方法是创建一个自己的查询,对吧? 最佳答案 您可以编写查询来获取该事件。还有一个过滤器可以卡在其中,
我有一个具有 Buddypress (1.8.1) 社交网络功能的多用户 Wordpress (3.6.1) 博客站点。我正在尝试向 Buddypress 成员个人资料添加一个选项卡,其中包含个人资料
我有一个网站,在这个网站上,我也在使用 BuddyPress 插件。但是现在我面临着与特殊和拉丁字符存储到数据库以及在前端错误显示相关的问题。 例如: 1) ö 显示为 u006f 2) Jörg 显
我是一名优秀的程序员,十分优秀!