drupal

Drupal 7 save user picture programmatically

本秂侑毒 提交于 2019-12-21 05:38:15
问题 I have found this script http://d.danylevskyi.com/node/7 which I have used as a starter for the below code. The goal is to be able to save a user picture: <?php define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $uid = 99; $account = user_load($uid); // get image information $image_path = 'public://avatars/upload/b8f1e69e83aa12cdd3d2babfbcd1fe27_4.gif'; $image_info = image_get_info($image_path); // create file object

Drupal Menu System - Outputting a Tree One Level Down

和自甴很熟 提交于 2019-12-21 05:05:35
问题 I've been reading through the various menu functions in Drupal, but there are sooo many, and I've reached a point of utter confusion and despair... Hoping one of the smarties here can help me out... Basically, I have four levels to my menu. I'm trying to create a tree that outputs from the second level down. So, the menu looks like this: LEVEL ONE > Sublevel A > Sublevel I > Sublevel a I'm trying to output the menu tree beginning with Sublevel A (i.e., Sublevel A > Sublevel I > Sublevel a)

Is Aegir drupal 8 compatible?

痞子三分冷 提交于 2019-12-21 05:01:15
问题 I don't find a clear answer on that matter. Can Aegir ( current 3.3 version ) work with drupal 8 sites ? 回答1: Absoultely, we have a lot of test D8 sites on Aegir 3.3 (we have a free SaaS service to test Drupal 8, based on Aegir). More generally, Aegir3 supports Drupal 8 since 3.1 I believe, and we wouldn't release a version that would break Drupal 8 support (I'm a maintainer of Aegir). 来源: https://stackoverflow.com/questions/35267828/is-aegir-drupal-8-compatible

'add another item' in non-CCK Drupal forms

亡梦爱人 提交于 2019-12-21 04:58:08
问题 CCK for Drupal has the handy feature of allowing a single CCK field to accept multiple values via a "add another item" button that results in an array of data in the node. I'm wondering if there's any easy way of adapting this for a non-CCK form that I'd be calling by drupal_get_form . I'd rather not have to re-invent the wheel with multi-step form techniques. Anyone done this? 回答1: It would be nice if they had included a more reduced example, but this Introduction to AHAH in Drupal, along

Drupal 7 hook_node_view add a form to the content of a node

送分小仙女□ 提交于 2019-12-21 04:23:15
问题 function example_module_node_view($node, $view_mode, $langcode) { $f = drupal_get_form('example_module_form', $node); $node->content['data_collection_form'] = array('#value' => $f, '#weight' => 1); } Why doesn't the form display? Am I doing something wrong? The form object is being populated. I can do #markup => 'Something' and it works. 回答1: The return from drupal_get_form is actually a render array itself so you could just do this: $f = drupal_get_form('example_module_form', $node); $f['

Event-driven CMS - advantages and disadvantages

房东的猫 提交于 2019-12-21 03:52:35
问题 I'm trying to identify some of the pros and cons of having a CMS that is event driven. Event driven is not uncommon. You see it in many scripting languages like Actionscript, javascript, jquery that involve a client. How about in a CMS where the events and their responses happen on the server. What advantages or disadvantages might this approach have, and what other approaches are there that people may prefer more. P.S. Please note that I use Actionscript, JQ, and JS as an example only. You

Steps to make a mobile application using drupal as a back end or service [closed]

孤街醉人 提交于 2019-12-21 03:01:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago . I want to make a mobile application with drupal as back end because already done the same application as a website.I want to use the same drupal for my android application Please any one help me with this 回答1: Phone: phonegap drupal Drupal: services Drupal: libraries api Not to

print drupal field_view_field value only

一世执手 提交于 2019-12-20 19:05:21
问题 I'm using the code below to print the out the field of nodes to specific areas and it works great. But theres an instance where I just want to print the value you of field without the label. Seems as it should be pretty easy but I'm having a bit of trouble. I'd appreciate any help as i'm pretty new to drupal. Thanks <?php print drupal_render(field_view_field('node', $node, 'field_description')); ?> 回答1: field_view_value() takes a $display argument that you can use to hide the label: $display

How to assign role with PHP in Drupal?

不问归期 提交于 2019-12-20 14:44:40
问题 I need to assign a kind of "premium status" to members that purchase an amount equal or greater than 100 € via PHP. Conditional Actions are already set up (user = anonymous/authenticated AND total amount = equal/greater than 100 AND user =! premium) but I'm missing the PHP part to actually say "then grant him the premium membership". How can I achieve this? EDIT: is the below code correct? if ($account) { $uid = $account->uid; $role_name = 'authenticated user'; $rid = db_result(db_query(

Style Drupal 7 log-in page

余生长醉 提交于 2019-12-20 14:11:51
问题 How do I style the login-page of Drupal 7? I used different methods like page-user-login.tpl or user-login.tpl of page-login.tpl but with no results. Is there an easy way to theme your login page in Drupal 7 in his own .tpl -file? 回答1: You can override any page template by naming your templates in the following convention: For page 'user/login': page--user--login.tpl.php For page 'foo/bar/' page--foo--bar.tpl.php See Core templates and About overriding themable output for more information.